Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

image text in transcribed

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago