/** HourlyWorker - A class to represent workers paid on a salaried basis)
 *
 * @author - Nancy Harris and Mike Stanley
 * @version - V2 - 10/1/08
 */
 
 public class HourlyWorkerV2 extends Employee
 {
 	
	/** explicit value constructor
	 * 
	 * @param name 	       The name of the worker
	 * @param SSN  	       The SSN of the worker
	 * @param homeDepartment The department of the worker
	 * @param exempt	       The number of payroll exemptions
	 & @param rate 	       The hourly rate for this employee
	 */
	public HourlyWorkerV2(String name, String SSN, String homeDepartment, int exempt, double rate)
	{
		super(name, SSN, homeDepartment, exempt, rate);
	} //end explicit value constructor
	
	/** 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 pay - The amount to pay this employee
	 */
	public double pay(double hours)
	{
		double pay;
		double timeAndHalf; // store what time and a half with original wage
		
		timeAndHalf = super.wage*1.5;
		super.hours = hours;  // stores the hours worked
		
		if(this.hours < 0)
		{
			pay = 0; // takes care of negative hours
		} //end if
		else if(super.hours <= 80)
		{
			pay = super.wage*super.hours; 
		}//end else if
		else //greater than 80 hours
		{
			pay = super.wage*80; //get wage for up to 80 hours
			//take wage and add the time and a half wage
			pay = pay+((hours-80)*(timeAndHalf));
		} //end else
	
		return pay;
	} //end pay()
} //end HourlyWorkerV2