Question: Answer accordingly. Do not give full coding. Given the following superclass named Staff and subclasses named Normal and Admin: Superclass: Staff Attributes : String staffId

Answer accordingly. Do not give full coding.  Answer accordingly. Do not give full coding. Given the following superclass
named Staff and subclasses named Normal and Admin: Superclass: Staff Attributes :
String staffId String name double basicSalary boolean professional //true or false Methods
: normal constructor mutator accessors toString() abstract double calculate Salary() Subclass :

Given the following superclass named Staff and subclasses named Normal and Admin: Superclass: Staff Attributes : String staffId String name double basicSalary boolean professional //true or false Methods : normal constructor mutator accessors toString() abstract double calculate Salary() Subclass : Normal Attributes : double basicAllowance Methods : normal constructor mutator accessors toString() abstract method definition Subclass : Admin Attributes : double adminAllowance int adminLevel //1, 2, 3 Methods : normal constructor mutator accessors toString() abstract method definition a. Write the definition of method calculateSalary() for both subclasses that calculate and return the total salary using the following information: For normal staff, the total salary will be calculated as shown in Table 1. Type Table 1 Total Salary basic salary + basic allowance + 500 basic salary + basic allowance + 100 Profesional Non-profesional For admin staff, the total salary will be calculated as shown in Table 2. Type Profesional Non-profesional Table 2 Total Salary basic salary + admin allowance + 800 basic salary + admin allowance + 500 (8 marks) b. Write program fragments for the following questions using the polymorphism concept. i. Declare an array of 450 staffs' objects named stf. (1 mark) ii. Calculate and display the total salary for each professional type. (3 marks) iii. Display the staff name and his/her total salary for every level 1 administration staff

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!