Question: Hello, first question here. I have partially completed this project but I'm having some trouble and would like to compare what I've got to see
Hello, first question here. I have partially completed this project but I'm having some trouble and would like to compare what I've got to see what I need to do to fix it. Thank you. Picture of assignment and superclass code provided below:


--------Superclass code---------
public class Employee extends Object { /** The first name. */ private String firstName; /** The last name. */ private String lastName; /** The pay rate. */ private double payRate; /** The hours worked. */ private double totalHours;
/** * Instantiates a new employee. */ public Employee() { this.firstName = ""; this.lastName = ""; this.payRate = 0.0; this.totalHours = 0.0; } /** * Instantiates a new employee. * * @param firstName the first name * @param lastName the last name * @param payRate the pay rate * @param totalHours the hours worked */ public Employee(String firstName, String lastName, double payRate, double totalHours) { if (payRate 0.0"); else if (payRate = 0.0");
this.firstName = firstName; this.lastName = lastName; this.payRate = payRate; this.totalHours = totalHours; } // end constructor
/** * Sets the first name. * * @param firstName the new first name */ public void setFirstName(String firstName) { this.firstName = firstName; }
/** * Sets the last name. * * @param lastName the last name * @return the last name */ public void setLastName(String lastName) { this.lastName = lastName; }
/** * Gets the first name. * * @return the first name */ public String getFirstName() { return firstName; }
/** * Gets the last name. * * @return the last name */ public String getLastName() { return lastName; }
/** * Sets the hours worked. * * @param totalHours the new hours worked */ public void setTotalHours(double totalHours) { if (totalHours = 0.0");
this.totalHours = totalHours; }
/** * Gets the total hours worked. * * @return the total hours worked */ public double getTotalHours() { return totalHours; }
/** * Sets the pay rate. * * @param payRate the new pay rate */ public void setPayRate(double payRate) { if (payRate = 0.0"); else if (payRate
/** * Gets the pay rate. * * @return the pay rate */ public double getPayRate() { return payRate; }
/** * * Returns the String representation of an Employee object. * * @return the string */ @Override // indicates that this method overrides a superclass method public String toString() { return String.format("%s: %s %s%n%s: %.2f%n%s: %.2f", "Employee", firstName, lastName, "Pay rate", payRate, "Total hours worked", totalHours); } } // End class Employee
The owners of the Annan Supermarket would like to have a program that computes the weekly gross pay of their non-exempt hourly employees. The user will enter an employee's first name, last name, the hourly rate of pay, and the number of hours worked for the week. In addition, Annan Supermarkets would like the program to compute the employee's net pay and overtime pay. Overtime hours, any hours over 40, are paid at 1.5 the regular hourly rate. Net pay is gross pay minus taxes (Refer to the tax table on the second page). Use Class Scanner to input the users data Define a class called HourlyEmployee that extends the Employee Class provided. The class must have private attributes regular ( 40) and overtime hours worked. The class must also have member functions to perform the following tasks A constructor to initialize the first name, last name, pay rate, and hours worked (See the Employee Class for more details) A setter method to set the hours work for the month (by the week- assume 4 weeks in a month) . A getter method to return the total regular hours work for the month . the total overtime hours for the month A getter method to retun the monthly regular pay A getter method to retum the monthly overtime pay A method that uses the super class' tostring method to display the output which must include the following information *Employee's first and last name Pay rate Total hours worked *Total regular hours worked Total overtime hours worked *Monthly Regular Pay Monthly overtime pay Monthly gross pay Monthly taxes Monthly net pay Write a test Class named HourlyEmployeeTest to test the methods in the Employee and HourlyEmployee Class. Allow the user to run the program as many times as possible until a sentinel first name value, no, has been entered. No input, processing, or output should happen in the main method. All work should be delegated to other non-static methods
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
