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. Use java to 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.
Use java to write a client
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.
![Employee
-name: String
-yearJoined: int
-basicSalary: double
-allowance: double
+ constructors
+ getters and setters
+ toString () : String
+ calculateSalary() : double
Manager
Clerk
-travelClaims: double
-overtimeHours: int
-overtimeRate: double
+ constructors
+ getters and setters
+ toString () : String
+ calculateSalary() : double
+ constructors
+ getters and setters
+ toString () : String
+ calcOvertimePay() : double
+ calculateSalary() : double](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F285003f4-8484-455a-be8b-60ecdbd88ce4%2Fc227dcaa-736f-449e-bb22-91fb7b560d2b%2Fnhj5s3_processed.png&w=3840&q=75)
![General Output
---Configuration: <Default>---
Type of Employee: Employee
=====
Name: John Smith
Year Joined: 2000
Basic Salary: RM2,500.00
Allowance: RM500.00
Monthly salary: RM3,000.00
Type of Employee: Manager
===
Name: Wong Fei
Year Joined: 2001
Basic Salary: RM5,000.00
Allowance: RM1,500.00
Travel Claims: RM320.50
Monthly salary: RM6,820.50
Type of Employee: Clerk
Name: Lim Tong
Year Joined: 1998
Basic Salary: RM1,200.00
Allowance: RM200.00
Overtime hours: 12
Overtime rate: RM3.50
Monthly salary: RM1,442.00
Process completed.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F285003f4-8484-455a-be8b-60ecdbd88ce4%2Fc227dcaa-736f-449e-bb22-91fb7b560d2b%2Fhhns0j_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)