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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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.

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
Transcribed Image Text: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
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.
Transcribed Image Text: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.
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY