Implement all the classes. The formula for calculating salary for each class is shown below: For the Employee class, salary = basic salary + allowance For the Manager class , salary = basic salary + allowance + travel claims For the Clerk class , salary = basic salary + allowance + overtime pay, where overtime pay = overtime hours x overtime rate. Set overtime rate as RM3.50. Write a client program that creates an array named empArray that stores an object of an Employee,a Manager and a Clerk. In your program, include a method called printElements() that takes an array as parameter and prints the type of employee, the object’s data field values (by invoking the toString() method) and the monthly salary.
(a)Implement all the classes. The formula for calculating salary for each class is shown below:
For the Employee class, salary = basic salary + allowance
For the Manager class , salary = basic salary + allowance + travel claims
For the Clerk class , salary = basic salary + allowance + overtime pay,
where overtime pay = overtime hours x overtime rate. Set overtime rate as RM3.50. Write a client program that creates an array named empArray that stores an object of an Employee,a Manager and a Clerk.
In your program, include a method called printElements() that takes an array as parameter and prints the type of employee, the object’s data field values (by invoking the
toString() method) and the monthly salary.
Step by step
Solved in 3 steps with 1 images