Class AnnualSalaryCheck

java.lang.Object
  extended by PayrollCheck
      extended by AnnualSalaryCheck

public class AnnualSalaryCheck
extends PayrollCheck

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.

Version:
Copyright (c) 2001
Author:
Carl B. Struck

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

dollarsCents

java.text.DecimalFormat dollarsCents

twoDecimals

java.text.DecimalFormat twoDecimals
Constructor Detail

AnnualSalaryCheck

public AnnualSalaryCheck()
No argument constructor sets field annualSalary to default value zero (0). Implicit call to superclass PayrollCheck sets fields checkNumber and employeeID to default values zero (0).


AnnualSalaryCheck

public AnnualSalaryCheck(int checkNumber,
                         int employeeID,
                         double annualSalary)
The constructor sets initial values for the annualSalary field. Explicit call to superclass PayrollCheck sets initial values for fields checkNumber and employeeID.

Parameters:
checkNumber - Number of payroll check from superclass Payroll.
employeeID - Employee's identification number from superclass Payroll.
annualSalary - Employee's annual salary.
Method Detail

getAnnualSalary

public double getAnnualSalary()
Returns current value of the annualSalary field.

Returns:
Employee's annual salary.

getGrossPay

public double getGrossPay()
Calculates and returns weekly gross pay which is the result of dividing annual salary by 52 (weeks in a year).

Returns:
Employee's weekly gross pay.

printLine

public java.lang.String printLine()
Returns detail line information for annualSalary field and calculated gross pay for a columnar report. Preceded by checkNumber and employeeID fields from call to printLine() method of superclass PayrollCheck.

Overrides:
printLine in class PayrollCheck
Returns:
Annual salary and gross pay for an annual salary check as part of a detail line as type String.

setAnnualSalary

public void setAnnualSalary(double annualSalary)
Sets the value for the annualSalary field which must be between 20,000 and 250,000. A value of zero (0) indicates that annualSalary field is empty.

Parameters:
annualSalary - Employee's annual salary.

toString

public java.lang.String toString()
Returns formatted annualSalary field and calculated gross pay including text labels. Preceded by checkNumber and employeeID fields from call to toString() method of superclass PayrollCheck.

Overrides:
toString in class PayrollCheck
Returns:
Formatted annual salary and gross pay for an annual salary check as type String.