/** HourlyWorker - A class to represent workers paid on a salaried basis)
 *
 * @author - Nancy Harris and Mark Koskinen
 * @version - V2 - October 1, 2008
 */
 
 public class HourlyWorkerV2 extends Employee
 {
 	
	/** explicit value constructor
	 * 
	 * @param name 	The name of the worker
	 * @param SSN  	The SSN of the worker
	 * @param exempt	The number of payroll exemptions
	 * @param rate 	The hourly rate for this employee
	 * @param homeDepartment the name of the department
	 */
	public HourlyWorkerV2(String name, String SSN, int exempt, double rate, String homeDepartment)
	{
		// use the variable super to get from the parent
		super.name = name;
		super.SSN = SSN;
		super.exemptions = exempt;
		super.wage = rate;
		super.homeDepartment = homeDepartment;
	}
	
	/** pay produces the pay amount for this employee
	 *  pay the rate * hours.  (we are disregarding overtime at this time)
	 *
	 * @param hours The number of hours for this hourly worker
	 *
	 * @return The amount to pay this employee
	 */
	public double pay(double hours)
	{
		double result = 0;
		this.hours = hours;
		if(hours<=80) result = this.hours * this.wage;
		// if over 80 hours find the pay for 80 hours and the pay for
		// each hour over 80 and add together
		if (hours>80) 
			{
			result = 80 * wage;
			double hoursOver = (hours - 80);
			hoursOver = hoursOver * wage * 1.5;
			result += hoursOver;
			}
		return result;
	}
}
