Question: #Java Staff # name: String # id: int PartTimer + Staff + Staff (name: String, id: int) + getName(): String + getId(): int + calculate

 #Java Staff # name: String # id: int PartTimer + Staff

+ Staff (name: String, id: int) + getName(): String + getId(): int

+ calculate Pay (): double + toString(): String skillLevel: int hoursWorked: int

#Java

Staff # name: String # id: int PartTimer + Staff + Staff (name: String, id: int) + getName(): String + getId(): int + calculate Pay (): double + toString(): String skillLevel: int hoursWorked: int + Part Timer (name: String, id: int, skillLevel: int, hoursWorked: int) getskilllevel(); int + getHoursWorked (): int + toString(): String + java.lang. Comparable + compareTo (o: Object) : int Figure 1: The relationship between Staff, PartTimer and Comparable Skill Level / Tahap Kemahiran Pay Rate Per Hour / Kadar Bayaran Per Jam 0 ( Basic / Asas) RM50.00 1 (Moderate / Sederhana) RM100.00 2 (Expert / Mahir) RM150.00 Table 1: Skill level and the pay rate per hour Write a complete Java program to create PartTimer class and test class based on the Figure 1, Table 1 and the following requirements: Partimer class is derived from Staff and implements Comparable Interface. The calculatePay() method from the staff class will be implemented in the subclass to calculate the employee's pay. The pay for Parttimer is based on the skill level of staff as shown in Table 1, which is the payment can be calculated by multiplying hours worked with the pay rate per hour. The method toString() will return the information of Parttimer object. The PartTimer class implements compareTo () method from java.lang.Comparable interface to compare the payment of two objects. Then write a test program that creates two PartTimer objects using parameterized constructor with any values assigned to their data fields. Then display all the information includes the comparison result of the payment for these two objects

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!