Menu

Java Programming Language Write Class Employee Represents Single Hourly Employee Class Pay Q43901739

JAVA programming Language:

Write a class Employee that represents a single hourly employeeand a class PayCheckthat calculates employee pay for the week.Employees know their names (String) the number of hours they workedin a given week, and their pay rate. PayChecks know an employeename, a rate, and the hours worked. PayChecks calculate the weeklypay based on rate * hours if the hours are 40 or less. If the hoursworked exceeds 40, the PayCheck applies an overtime rate of 1.5xfor all of the hours in excess of 40. Create:

  • An Employee constructor that takes a name and pay rate asparameters and sets the instance values appropriately. Thisconstructor should also initialize the hours worked to zero (0)upon instantiation.

  • An Employee method addHoursWorked() which takes a parameter(double) and adds the value of that parameter to the current numberof hours the Employee has worked this week.

  • An Employee method resetHoursWorked() that resets the employee’shours worked for the week to zero.

  • An Employee method getWeeklyCheck() which, when called, returnsa new PayCheck object that is initialized to the current Employeename, rate and hours worked.

  • A PayCheck constructor that takes the employee name, rate, andhours worked as parameters and calculates (and stores) the totalpay for the week.

  • A PayCheck method getTotalPay() that returns the total pay forthe week.

  • A toString method for BOTH classes, allowing Employee objects tobe represented by the employee name, and PayCheck objects by thetotalPay (in proper dollars/cents $xxx.yy format).

Expert Answer


Answer to JAVA programming Language: Write a class Employee that represents a single hourly employee and a class PayCheckthat calc…

OR