/** HourlyWorker - A class to represent workers paid on a salaried basis)
 *
 * @author - Nancy Harris and Pan He
 * @version - V2 - 10/01/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 department to pay the salaries or wages 
	 */
	public HourlyWorkerV2(String name, String SSN, String homeDepartment,int exempt, double rate)
	{
		//call the parent constructor by calling super and passing in the appropriate
		//parameters
		super(name, SSN,homeDepartment, exempt, rate);
	}  // end method
	
	/** 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)
	{
		// store the hours worked
		super.hours = hours;  
		double pay;
		pay = 0.0;
		// the payment amount for this hourly worker
		if(super.hours <= 80) // pay the worker up to 80 hours at their normal wage rate
			pay = super.wage * super.hours; 
		// Any hours over and above 80 hours should be paid at time and 1/2.(1.5 * their normal rate)
		else pay = super.wage * 80 + (super.wage * 1.5) * (super.hours - 80);
		return pay; // return the pay value

	}  // end method
}  // end class