(3 marks)
Write a class named Staff and a class named Engineer extended from Staff (i.e. Staff is a super class and Engineer is a subclass) with the following information:
Staff
Where:
-id: int
-salary: int
+Staff()
+Staff(id:int,salary:int)
+getld ():int
+getSalary():int
+setSalary(salary: int):void
+toString():String
Staff()-default constructor
Staff (id:int, salary:int)-parameterized constructor which sets values to id and salary
getId(): int-return id
getSalary(): int-return salary
setSalary(salary: int): void update the salary. If the salary is less than 1000 then set it to 1000
toString(): String-return a string format of the Staff: id, salary
Engineer
-benefits: int
Where:
4 of 5
Paper No: 1
+ 100%
Zoom
Close