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) (Κ,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) (Ε,2,15) (F,11,6) (1,6,14) (1,12,15) (Κ,7,9)
(C,1,2) (D,10,3) (Ε,2,15) (1,6,14) (J,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 (salaryand ability can get arbitrary, even negative values).
void f1() - Do not edit this method. Your task is to complete the insert(...) method above only. Output in the
file f1.txt must be the following:
(A,7,9) (C,4,3) (D,8,6) (Ε,2,5) (Y,6,-7) (F,-6,7)
(F,-6,7) (Ε,2,5) (C,4,3) (1,6,-7) (Α,7,9) (D,8,6)
+ 120%
Zoom
Close