Class Payee

java.lang.Object
  
public class Payee
extends java.lang.Object

The Payee class calculates payroll for regular and overtime workers calculated from the hours worked and pay rate instance variables.

Version:
CST141 Fall 2015
Author:
Prof. Carl B. Struck

Constructor Summary
Payee()
          No parameter constructor for objects of class Payee.
Payee(double hoursWorked, double payRate)
          Constructor for objects of class Payee with parameters that initializes the hours worked and pay rate instance variables.
 
Method Summary
 double getGrossPay()
          Calculates and returns gross pay.
 double getHoursWorked()
          Accessor method for the hours worked instance variable.
 double getPayRate()
          Accessor method for the pay rate instance variable.
 void setHoursWorked(double hoursWorked)
          Mutator method for the hours worked instance variable.
 void setPayRate(double payRate)
          Mutator method for the pay rate instance variable.
 java.lang.String toString()
          Returns the formatted hoursWorked and payRate instance variable values along with the calculated gross pay with labels.
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Payee

public Payee()
      throws java.lang.Exception
No parameter constructor for objects of class Payee. Initializes the hours worked and pay rate instance variables to default values of zero (0).

Throws:
java.lang.Exception

Payee

public Payee(double hoursWorked,
             double payRate)
      throws java.lang.Exception
Constructor for objects of class Payee with parameters that initializes the hours worked and pay rate instance variables.

Parameters:
hoursWorked - The number of hours worked for the week
payRate - The employee's per hour pay rate
Throws:
java.lang.Exception
Method Detail

getGrossPay

public double getGrossPay()
Calculates and returns gross pay. If hours worked is greater than 40, calculates overtime pay.

Returns:
The employee's gross pay for the week

getHoursWorked

public double getHoursWorked()
Accessor method for the hours worked instance variable.

Returns:
The number of hours worked for the week

getPayRate

public double getPayRate()
Accessor method for the pay rate instance variable.

Returns:
The employee's per hour pay rate

setHoursWorked

public void setHoursWorked(double hoursWorked)
                    throws java.lang.Exception
Mutator method for the hours worked instance variable. Validates that hours worked is between 0.25 and 60.0, or is the default value of zero (0).

Parameters:
hoursWorked - The number of hours worked for the week
Throws:
java.lang.Exception - if hours worked is not between 0.25 and 60.0, or is not zero (0)

setPayRate

public void setPayRate(double payRate)
                throws java.lang.Exception
Mutator method for the pay rate instance variable. Validates that pay rate is between 7.50 and 75.00, or is the default value of zero (0).

Parameters:
payRate - The employee's per hour pay rate
Throws:
java.lang.Exception - if pay rate is not between 7.00 and 75.00, or is not zero (0)

toString

public java.lang.String toString()
Returns the formatted hoursWorked and payRate instance variable values along with the calculated gross pay with labels.

Overrides:
toString in class java.lang.Object
Returns:
A Payee's instance variables and calculated gross pay with labels