java.lang.ObjectPayrollCheck
HourlySalaryCheck
public class HourlySalaryCheck
HourlySalaryCheck class definition for employees who are payed an hourly rate. The field hoursWorked is multiplied by payRate to calculate gross pay.
Field Summary | |
---|---|
(package private) java.text.DecimalFormat |
dollarsCents
|
(package private) java.text.DecimalFormat |
twoDecimals
|
Constructor Summary | |
---|---|
HourlySalaryCheck()
No argument constructor sets fields hoursWorked and payRate to default values zero (0). |
|
HourlySalaryCheck(int checkNumber,
int employeeID,
double hoursWorked,
double payRate)
The constructor sets initial values for fields hoursWorked and payRate. |
Method Summary | |
---|---|
double |
getGrossPay()
Calculates and returns weekly gross pay. |
double |
getHoursWorked()
Returns current value of the hoursWorked field. |
double |
getPayRate()
Returns current value of the payRate field. |
java.lang.String |
printLine()
Returns detail line information for hoursWorked and payRate fields, and calculated gross pay for a columnar report. |
void |
setHourlySalaryCheck(double hoursWorked,
double payRate)
Method takes parameters for the fields hoursWorked and payRate and passes them to their respective set methods. |
void |
setHoursWorked(double hoursWorked)
Sets the value for the hoursWorked field which must be between 0.25 and 168.0. |
void |
setPayRate(double payRate)
Sets the value for the payRate field which must be between 7.25 and 75.00. |
java.lang.String |
toString()
Returns formatted hoursWorked and payRate fields, and calculated gross pay including text labels. |
Methods inherited from class PayrollCheck |
---|
getCheckNumber, getEmployeeID, printHeading, setCheckNumber, setEmployeeID, setPayrollCheck |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
java.text.DecimalFormat dollarsCents
java.text.DecimalFormat twoDecimals
Constructor Detail |
---|
public HourlySalaryCheck()
public HourlySalaryCheck(int checkNumber, int employeeID, double hoursWorked, double payRate)
checkNumber
- Number of payroll check from superclass Payroll.employeeID
- Employee's identification number from superclass Payroll.hoursWorked
- Number of hours worked for the week.payRate
- Employee's hourly pay rate.Method Detail |
---|
public double getGrossPay()
public double getHoursWorked()
public double getPayRate()
public java.lang.String printLine()
printLine
in class PayrollCheck
public void setHourlySalaryCheck(double hoursWorked, double payRate)
hoursWorked
- Number of hours worked for the week.payRate
- Employee's hourly pay rate.public void setHoursWorked(double hoursWorked)
hoursWorked
- Number of hours worked for the week.public void setPayRate(double payRate)
payRate
- Employee's hourly pay rate.public java.lang.String toString()
toString
in class PayrollCheck