java.lang.Object
public class Payee
The Payee class calculates payroll for regular and overtime workers calculated from the hours worked and pay rate instance variables.
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 |
---|
public Payee() throws java.lang.Exception
java.lang.Exception
public Payee(double hoursWorked, double payRate) throws java.lang.Exception
hoursWorked
- The number of hours worked for the weekpayRate
- The employee's per hour pay rate
java.lang.Exception
Method Detail |
---|
public double getGrossPay()
public double getHoursWorked()
public double getPayRate()
public void setHoursWorked(double hoursWorked) throws java.lang.Exception
hoursWorked
- The number of hours worked for the week
java.lang.Exception
- if hours worked is not between 0.25 and 60.0, or is not zero (0)public void setPayRate(double payRate) throws java.lang.Exception
payRate
- The employee's per hour pay rate
java.lang.Exception
- if pay rate is not between 7.00 and 75.00, or is not zero (0)public java.lang.String toString()
toString
in class java.lang.Object