/** HourlyWorker - A class to represent workers paid on a salaried basis)
 *
 * @author - Nancy Harris and Jeremy Halterman
 * @version - V2 - 1.1
 * @date - 10-01-08
 */
 
 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
	 */
	public HourlyWorkerV2(String name, String SSN, int exempt, double rate, String dept)
	{
		// so how do we get this into the Employee class?
		super(name, SSN, exempt, rate, dept);
	}//end 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  this.grossPay    The amount to pay this employee
	 */
	public double pay(double hours)
	{
		this.hours = hours;  // stores the hours worked
		
		//declares and initializes a local variable for holding the amount of OT
		double overtimePay = 0;
		//a constant that is 80 hours biweekly 
		final double reghours = 80;
		//a variable for multiplying the overtime hours by
		double payRate = 0;
		
        //figure regular pay for 80 hours, then figure for over 80 hours
		if(this.hours > reghours)
		{                             
            //establishes pay for 80 hour or under
			this.grossPay = reghours * this.wage;
			
			//states the overtime rate
			payRate = this.wage * 1.5;
			
			/*figures the overtime pay by subtracting 
			 * the 80 hour base from the actual hours*/
			overtimePay = (this.hours - reghours) * payRate;
			
			//add overtime into gross pay
			this.grossPay += overtimePay;
		}
		    else        //calculate gross pay
			{
			
			this.grossPay = this.hours * this.wage;
			}//end if-else   
		
		//return gross pay
		return this.grossPay;
	}//end hourly pay method
}//end class