/** HourlyEmployee.java models an hourly employee.
 * @author Joel Adams, for Alice+Java
 * @see Employee.java
 */
import java.util.Scanner;

public class HourlyEmployee extends Employee {
	public HourlyEmployee() {
		super();
		myHours = myRate = 0.0;
	}
	
	public HourlyEmployee(String name, int id, 
			               double hours, double rate) {
		super(name, id);
		myHours = hours;
		myRate = rate;
	}
	
	public double getHours() { return myHours; }
	public double getRate()  { return myRate;  }
	
	public double getPay() {
		final double OVERTIME_BONUS = 0.5;
		double pay = myHours * myRate;
		if (myHours > 40) {
			double overtimeHours = myHours - 40;
			pay += overtimeHours * myRate * OVERTIME_BONUS;
		}
		
		return pay;
	}
	
	public void read(Scanner in) {
		super.read(in);
		myHours = in.nextDouble();
		myRate = in.nextDouble();
	}
	
	public String toString() { 
		return super.toString() + "\t" + myRate + "\t" + myHours;
	}
	
	private double myHours;
	private double myRate;
}
