java.lang.ObjectPayrollCheck
AnnualSalaryCheck
public class AnnualSalaryCheck
AnnualSalaryCheck class definition for employees who are payed based upon an annual salary. The field annualSalary is divided by 52 (weeks in a year) to calculate gross pay.
Field Summary | |
---|---|
(package private) java.text.DecimalFormat |
dollarsCents
|
(package private) java.text.DecimalFormat |
twoDecimals
|
Constructor Summary | |
---|---|
AnnualSalaryCheck()
No argument constructor sets field annualSalary to default value zero (0). |
|
AnnualSalaryCheck(int checkNumber,
int employeeID,
double annualSalary)
The constructor sets initial values for the annualSalary field. |
Method Summary | |
---|---|
double |
getAnnualSalary()
Returns current value of the annualSalary field. |
double |
getGrossPay()
Calculates and returns weekly gross pay which is the result of dividing annual salary by 52 (weeks in a year). |
java.lang.String |
printLine()
Returns detail line information for annualSalary field and calculated gross pay for a columnar report. |
void |
setAnnualSalary(double annualSalary)
Sets the value for the annualSalary field which must be between 20,000 and 250,000. |
java.lang.String |
toString()
Returns formatted annualSalary field 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 AnnualSalaryCheck()
public AnnualSalaryCheck(int checkNumber, int employeeID, double annualSalary)
checkNumber
- Number of payroll check from superclass Payroll.employeeID
- Employee's identification number from superclass Payroll.annualSalary
- Employee's annual salary.Method Detail |
---|
public double getAnnualSalary()
public double getGrossPay()
public java.lang.String printLine()
printLine
in class PayrollCheck
public void setAnnualSalary(double annualSalary)
annualSalary
- Employee's annual salary.public java.lang.String toString()
toString
in class PayrollCheck