1  public class HourlyEmployee extends Employee
  2  {
  3     private double hourlyWage;
  4  
  5     /**
  6        Constructs an hourly employee with a given name and hourly wage.
  7        @param name the name of this employee
  8        @param wage the hourly wage 
  9     */
 10     public HourlyEmployee(String name, double wage)
 11     {
 12        setName(name);
 13        hourlyWage = wage;
 14     }
 15   
 16     public double weeklyPay(int hoursWorked)
 17     {
 18        double pay = hoursWorked * hourlyWage;
 19        if (hoursWorked > 40)
 20        {
 21           pay = pay + ((hoursWorked - 40) * 0.5) * hourlyWage;
 22        }
 23        return pay;
 24     }
 25  }
 26