/** A class that extends the abstract Employee class by
  adding the fields wage and hours, and implementing the 
  abstract earnings() method
*/
public class HourlyWorker extends Employee {
  private double wage;
  private double hours;

  /** a constructor that initializes the fields fistName,
    lastName, wage, and hours, according to the
    respective parameters */
  public HourlyWorker(String first, String last, double wagePerHour, double hoursWorked) {
    super(first, last);
    wage = wagePerHour;
    hours = hoursWorked;
  }

  /** reset the field wage based on the parameter */
  public void setWage(double wagePerHour) {
    wage = wagePerHour;
  }

  /** reset the field hours based on the parameter */
  public void setHours (double hoursWorked) {
    hours = hoursWorked;
  }

  /** implement the abstract earnings() method */
  public double earnings() {
    return wage * hours;
  }

  /** override the toString() method */
  public String toString() {
    return "Hourly Worker: " + super.toString();
  }
}
