The class Employee with 3 data members: Name, Age and Salary is given and you do not need to edit it.The MyList class is a linked list of Employee objects. The following methods should be completed:
void f1(self, name, age, salary) - check if name start with "Z" or age < 15 or salary <=0 then do nothing, otherwise add new Employee with Name=name, Age=age and Salary=salary to the first of the list. The age and salary can get arbitrary value, even negative. Output in this case like that
OUTPUT
(C, 60, 46) (P, 16, 20) (ΧΗ, 36, 51) (H, 18, 30) (F, 26, 27) (E, 45, 52) (C, 50, 42) (D, 42, 43) (B, 32, 23) (R, 30,30)
void f2(self, A) - There is given object A (something like this Employee("AA",27,20)) with name,age and salary). You should write statements in method f2(self, A) to add the object A at before the first Employee having age is an even number. Output in this case like that:
OUTPUT
(C, 61, 46) (P, 17, 20) (ΧΗ, 36, 51) (H, 18, 30) (F, 26, 27) (E, 45, 52) (C, 50, 42) (D, 42, 43) (B, 32, 23) (R, 30,30)
(C, 61, 46) (P, 17, 20) (ΑΑ, 27, 20) (ΧΗ, 36, 51) (Η, 18, 30) (F, 26, 27) (E, 45, 52) (C, 50, 42) (D, 42, 43) (B, 32,23) (R, 30, 30)
void f3(self) - Delete the first node having age is an even number. Output in this case like that:
OUTPUT
(C, 61, 46) (P, 17, 20) (ΧΗ, 36, 51) (H, 18, 30) (F, 26, 27) (E, 45, 52) (C, 50, 42) (D, 42, 43) (B, 32, 23) (R, 30,
30)
+ 100%
Zoom
Close