Source of EmployeePerson.java


  1: //EmployeePerson.java

  3: abstract class EmployeePerson
  4: {
  5:     protected String fullName;       // In the format last name, first name
  6:     protected String departmentCode;
  7:     protected String birthday;
  8:     protected int annualSalary;

 10:     // ***********************************************************************

 12:     // Default constructor. Set protected variables to the empty string or 0
 13:     public EmployeePerson()
 14:     {
 15:         fullName = "";
 16:         departmentCode = "";
 17:         birthday = "";
 18:         annualSalary = 0;
 19:     }

 21:     // ***********************************************************************

 23:     // Constructor with parameters to set the private variables
 24:     public EmployeePerson
 25:     (
 26:         String empFullName,
 27:         String empDepartmentCode,
 28:         String empBirthday,
 29:         int empAnnualSalary
 30:     )
 31:     {
 32:         setData(empFullName, empDepartmentCode, empBirthday, empAnnualSalary);
 33:     }

 35:     // ***********************************************************************

 37:     public void setData
 38:     (
 39:         String empFullName,
 40:         String empDepartmentCode,
 41:         String empBirthday,
 42:         int empAnnualSalary
 43:     )
 44:     {
 45:         fullName       = empFullName;
 46:         departmentCode = empDepartmentCode;
 47:         birthday       = empBirthday;
 48:         annualSalary   = empAnnualSalary;
 49:     }

 51:     // ***********************************************************************

 53:     // Ensure each subclass has a printInfo() method
 54:     abstract void printInfo();

 56:     // ***********************************************************************

 58:     // Ensure each subclass has a getAnnualBonus() method
 59:     abstract int getAnnualBonus();
 60: }