void f4() Sort all elements descendingly by salary. The content of the output file f4.txt must be the following:
(C,1,2) (D,10,3) (Ε,2,15) (F,11,6) (1,6,14) (J,12,15) (K,7,9)(J,12,15) (F,11,6) (D,10,3) (K,7,9) (1,6,14) (Ε,2,15) (C,1,2)
void f5()-Sort the linked list in descending order of salary, delete the 1st and 3rd elements. The content of the output file f5.txt must be the following:
(C,1,2) (D,10,3) (Ε,2,15) (F,11,6) (1,6,14) (J,12,15) (K,7,9)
(F,11,6) (K,7,9) (1,6,14) (Ε,2,15) (C,1,2)
void f6() - Find and delete the Worker having Salary = 11. The content of the output file f6.txt must be the following:
(C,1,2) (D,10,3) (E,2,15) (F,11,6) (1,6,14) (J,12,15) (K,7,9)(
C,1,2) (D,10,3) (Ε,2,15) (L,6,14) (1,12,15) (K,7,9)
Question 2: (4 marks)
In this question you should complete some methods in BSTree.java file.
The class Worker (with 3 data members: name, salary and ability) is given and you do not need to edit it. The BSTree class is a binary search tree of Worker objects. The variable salary is the key of the tree, thus it must be unique. The following methods should be completed:
void insert(String xName, int xSalary, int xAbility) - check if xName.charAt(0) == 'B' then do nothing,otherwise insert new Worker object with name=xName, salary=xSalary, ability=xAbility to the tree (salary
and ability can get arhitranu ovan negative valuaci
+110%
Zoom
Close