Luninariel

We Live For You Healthcare

Feb 22nd, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 26.40 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileNotFoundException;
  3. import java.util.ArrayList;
  4. import java.util.Scanner;
  5. import java.util.Arrays;
  6. /**
  7.  * This program will perform the following functions:
  8.  * A class is created for Employees in general.
  9.  * A subclass is created for the Entire WLFU Team
  10.  * A subclass is created for the Regional Cities
  11.  * A subclass is created for Staff Categories
  12.  * A subclass is created for Administrative, Doctors, Nurses, and Medical Support.
  13.  * A integer defined as "SpecialEmployee" is used to categorize the staff within their respective Subclass as defined below:
  14.  * Administrative: 1 - Senior Executive, 2 - Junior Executive, 3 - Support
  15.  * Doctor: Number of Patients
  16.  * Nurses: 1 - Clinical Nurses, 2 - Hospital Floor Nurse, 3 - Hospital Administrative Nurse
  17.  * Medical Support: 1 - Support Type 1, 2 - Support type 2
  18.  * An employee's Name, SSN, Race, and Category is collected.
  19.  * Each employee's salary is calculated based on their position and if applicable other aspects (Bonuses etc.)
  20.  * Total salary for each employee is calculated
  21.  * State and Federal taxes are calculated.
  22.  * All information is stored into an object
  23.  * Once objects are created they're stored into an array.
  24.  * That array is then added to an ArrayList and managed Generically by the WLFU Generic Manager.
  25.  * The 3rd Element in the ArrayList is printed
  26.  * The Entire ArrayList of Employees is sorted from Smallest to Largest based on their Salary
  27.  * The Entire Arraylist of Employees is Printed.
  28.  * To prove the Generic Capability of the WLFU Generic Manager a list of Ints is Read, Sorted, and Printed.
  29.  */
  30.  
  31. public class HospitalFrame {
  32.  
  33.     public static void main(String[] args) {
  34.         HospitalFrame me = new HospitalFrame();
  35.  
  36.         //Create an Arraylist of Ints to contain Ints.Txt
  37.         ArrayList<Integer> myInts = new ArrayList<Integer>();
  38.  
  39.         //Create an Arraylist of Employees to contain Staff.txt
  40.         ArrayList<Employee> BostonEmployeeList = new ArrayList<Employee>();
  41.  
  42.  
  43.         //Make a new instance of WLFU Manager for ints
  44.         WLFUManager<Integer> genericInts = me.new WLFUManager<Integer>();
  45.  
  46.         //Make a new Instance of WLFU Manager for Employees.
  47.         WLFUManager<Employee> genericEmployees = me.new WLFUManager<Employee>();
  48.  
  49.         //An Array to Hold the Employees of Boston
  50.         Employee [] BostonEmployee = new Employee[4];
  51.  
  52.  
  53.        try {
  54.            int n=0;
  55.             //Create a scanner to read the information contained within Staff.txt
  56.             Scanner StaffInput = new Scanner(new File("src/main/Staff.txt"));
  57.  
  58.             //Gather the information from the records in Staff.txt and set them equal to their respective variables
  59.             while (StaffInput.hasNextLine()) {
  60.                 String StaffName = StaffInput.next();
  61.                 String StaffRole = StaffInput.next();
  62.                 String StaffSSN = StaffInput.next();
  63.                 int SpecialEmployee = StaffInput.nextInt();
  64.                 String StaffRaceAbbreviation = StaffInput.next();
  65.  
  66.                 //If statement that checks an employees Role, to decide which array or ArrayList to add them to.
  67.                 if(StaffRole.equals("Doctor")){
  68.                     BostonDoctor DoctorsOfBoston = me.new BostonDoctor(StaffName,StaffRole,StaffSSN,SpecialEmployee,StaffRaceAbbreviation);
  69.                     BostonEmployee[n] = DoctorsOfBoston;
  70.                     n++;
  71.                     genericEmployees.Add(BostonEmployeeList,DoctorsOfBoston);
  72.                 }
  73.                 else if(StaffRole.equals("Nurse")){
  74.                     BostonNurse NursesOfBoston = me.new BostonNurse(StaffName,StaffRole,StaffSSN,SpecialEmployee,StaffRaceAbbreviation);
  75.                     BostonEmployee[n] = NursesOfBoston;
  76.                     n++;
  77.                     genericEmployees.Add(BostonEmployeeList, NursesOfBoston);
  78.                 }
  79.                 else if (StaffRole.equals("Support")){
  80.                     BostonSupport SupportOfBoston = me.new BostonSupport(StaffName,StaffRole,StaffSSN,SpecialEmployee,StaffRaceAbbreviation);
  81.                     BostonEmployee[n] = SupportOfBoston;
  82.                     n++;
  83.                     genericEmployees.Add(BostonEmployeeList,SupportOfBoston);
  84.                 }
  85.                 else{
  86.                     BostonAdmin AdministratorsOfBoston = me.new BostonAdmin(StaffName,StaffRole,StaffSSN,SpecialEmployee,StaffRaceAbbreviation);
  87.                     BostonEmployee [n] = AdministratorsOfBoston;
  88.                     n++;
  89.                     genericEmployees.Add(BostonEmployeeList, AdministratorsOfBoston);
  90.                 }
  91.  
  92.  
  93.  
  94.             }
  95.  
  96.            //Calculate the Salary, State Tax, and Federal tax of the Objects within the Boston Employee Array
  97.            for(int i=0; i < 4; i++){
  98.            BostonEmployee[i].CalcSalary();
  99.            BostonEmployee[i].CalcStateTax();
  100.            BostonEmployee[i].CalculateFedTax();
  101.            }
  102.            //Sort the BostonEmployee Array
  103.            Sort(BostonEmployee);
  104.  
  105.  
  106.            System.out.println("\n Printing the Array Boston Employee Sorted from Smallest to Largest Based on Total Salary.");
  107.            //Print the sorted Array
  108.            for(int i=0; i<4; i++){
  109.                BostonEmployee[i].Print();
  110.            }
  111.            //Calculate the Salary, State Tax, and Federal Tax of the Objects within the Arraylist of Boston Employees.
  112.           for(int i=0; i<BostonEmployeeList.size(); i++){
  113.               BostonEmployeeList.get(i).CalcSalary();
  114.               BostonEmployeeList.get(i).CalcStateTax();
  115.               BostonEmployeeList.get(i).CalculateFedTax();
  116.           }
  117.           System.out.println("\n Printing the third Element from The Boston Employee ArrayList ");
  118.           //Print the third element in the ArrayList using the Get method from WLFU Manager
  119.           genericEmployees.Get(BostonEmployeeList,3).Print();
  120.  
  121.           //Sort the Arraylist.
  122.            genericEmployees.Sort(BostonEmployeeList);
  123.  
  124.            System.out.println("\n Printing the ArrayList sorted Smaller to Larger using WLFU Manager");
  125.            //Print the ArrayList sorted Smallest to Largest
  126.            for(int i=0; i<BostonEmployeeList.size(); i++){
  127.            genericEmployees.Get(BostonEmployeeList,i).Print();
  128.            }
  129.  
  130.  
  131.  
  132.             //Create a scanner to read the information contained with Ints.txt
  133.             Scanner IntInput = new Scanner(new File("src/main/Ints.txt"));
  134.             //Add the contents of Int input to their ArrayList
  135.            while(IntInput.hasNextLine()){
  136.                genericInts.Add(myInts, IntInput.nextInt());
  137.            }
  138.  
  139.            //Sort the contents of Ints.txt
  140.            genericInts.Sort(myInts);
  141.  
  142.         } catch (FileNotFoundException e) {
  143.             System.err.println("File  was not found");
  144.         }
  145.  
  146.  
  147.        System.out.println("\n Proving The Generic Nature of WLFU Manager by Sorting a list of Ints.");
  148.        //Print the sorted contents of Ints.txt
  149.         for(int i = 0; i < myInts.size(); i++){
  150.             System.out.println(myInts.get(i));
  151.         }
  152.  
  153.  
  154.     }
  155.    
  156.     //Sort method to sort an Array from Smallest to Largest based on Total Salary.
  157.     public static void Sort(Employee[] BostonEmployee) {
  158.         //this method will sort an array of Solids objects based on their CompareTo function
  159.         Employee xsave;
  160.         int isw = 1;
  161.         while (isw == 1) {
  162.             isw = 0;
  163.             for (int i = 0; i < 4 - 1 ; i++) {
  164.                 switch (BostonEmployee[i].compareTo(BostonEmployee[i + 1])) {
  165.                     case -1://the objects in array x are in the right order
  166.                         break;
  167.                     case 1://objects out of order, they must be changed.
  168.                         // This is where to the place holder is used to swap values
  169.                         xsave = BostonEmployee[i];
  170.                         BostonEmployee[i] = BostonEmployee[i + 1];
  171.                         BostonEmployee[i + 1] = xsave;
  172.                         isw = 1;
  173.                         break;
  174.                     default://objects are equal no change
  175.                 }
  176.             }
  177.         }
  178.     }
  179.    
  180.     //Generic Manager for the WLFU system
  181.     public class WLFUManager <T extends Comparable<T>> {
  182.         int number = 0;
  183.  
  184.         //Generically adds an object (in this case students) to the Academic Class ArrayList
  185.         public int Add(ArrayList<T> listName, T myGenericData) {
  186.             listName.add(myGenericData);
  187.             number++;
  188.             return number;
  189.         }
  190.         //Getter to retrieve the record in the int location of an ArrayList
  191.         public T Get(ArrayList<T> listName, int x){
  192.             return listName.get(x);
  193.         }
  194.  
  195.         //Generically sorts the object from Smaller to Larger
  196.         public void Sort(ArrayList<T> listName) {
  197.             T xsave;
  198.             int isw = 1;
  199.             while (isw == 1) {
  200.                 isw = 0;
  201.                 for (int i = 0; i < listName.size() - 1; i++) {
  202.                     switch (listName.get(i).compareTo(listName.get(i + 1))) {
  203.                         case -1://the objects in array x are in the right order
  204.                             break;
  205.                         case 1://objects out of order, they must be changed.
  206.                             // This is where to the place holder is used to swap values
  207.                             xsave = listName.get(i);
  208.                             listName.set(i, listName.get(i + 1));
  209.                             listName.set(i + 1, xsave);
  210.                             isw = 1;
  211.                             break;
  212.                         default://objects are equal no change
  213.                     }
  214.                 }
  215.             }
  216.         }
  217.         public int GetNumber() {
  218.             return number;
  219.         }
  220.     }
  221.  
  222.  
  223.  
  224.     //The Boston Medical Support class is used to assign the role of Medical Support to an employee that lives in Boston
  225.     public class BostonSupport extends StaffCategories {
  226.         double BaseSalary = 0;
  227.         double StateTax = 0;
  228.         double FedTax = 0;
  229.         String PositionTitle;
  230.  
  231.  
  232.         //Constructor for Boston Support
  233.         public BostonSupport(String EmployeeName, String EmployeeRole, String EmployeeSSN, int SpecialEmployee, String RaceAbbreviation) {
  234.             super(EmployeeName, EmployeeRole, EmployeeSSN, SpecialEmployee, RaceAbbreviation);
  235.         }
  236.        
  237.         //Updates The int that defines the Special Employee. Please Note: After updating, Calculations for Salary, Tax, and Fed tax must be run again.
  238.         public void UpdateSpecialInfo(int UpdatedInfo){
  239.             UpdatedInfo = SpecialEmployee;
  240.         }
  241.  
  242.        
  243.        //Calculates the Position based on their Special Employee number
  244.         public String calcPositionTitle(){
  245.             if(SpecialEmployee == 1){
  246.                 PositionTitle = "Medical Support Type 1";
  247.             }
  248.             else if (SpecialEmployee == 2){
  249.                 PositionTitle = "Medical Support Type 2";
  250.             }
  251.             return PositionTitle;
  252.         }
  253.        
  254.         //Calculates base salary based on Special Employee number
  255.         public double calcBaseSalary(){
  256.             if(SpecialEmployee == 1){
  257.                 BaseSalary = 45000;
  258.             }
  259.             else if (SpecialEmployee == 2){
  260.                 BaseSalary = 35000;
  261.             }
  262.             return BaseSalary;
  263.         }
  264.         //Calculates the Salary of a Support Staff
  265.         public void CalcSalary() {
  266.             Salary = calcBaseSalary()+ (calcBaseSalary() * BostonCOLA);
  267.         }
  268.  
  269.         //Calculates State Taxes
  270.         public void CalcStateTax() {
  271.             StateTax = Salary * MassStateTax;
  272.         }
  273.         //Calculates the Federal taxes
  274.         public void CalculateFedTax() {
  275.             FedTax = Salary * FederalTax;
  276.         }
  277.  
  278.         //Getter for State Tax
  279.         public double getStateTax() {
  280.             return StateTax;
  281.         }
  282.  
  283.         //Getter for Federal Tax
  284.         public double getFedTax() {
  285.             return FedTax;
  286.         }
  287.         public void Print(){
  288.             System.out.println("\n Name: " + EmployeeName + "\n Position: Boston " + EmployeeRole +"\n Role: "+calcPositionTitle()+"\n Race: " +EmployeeFullRace(RaceAbbreviation)+"\n SSN: "+EmployeeSSN+"\n Base Salary: $"+ calcBaseSalary()+"\n COLA (15%): $"+ (calcBaseSalary()*BostonCOLA)+"\n Total Salary: $"+getSalary()+"\n Estimated Taxes "+"\n Federal Taxes: $"+FedTax+"\n State Taxes: $"+StateTax);
  289.         }
  290.  
  291.  
  292.     }
  293.  
  294.     //The Boston Admin Class is used to assign the role of an Administrator to an employee that lives in Boston
  295.     public class BostonAdmin extends StaffCategories {
  296.         double BaseSalary =0;
  297.         double Bonus = 0;
  298.         double SalaryPostBonus =0;
  299.         double StateTax = 0;
  300.         double FedTax = 0;
  301.         String PositionTitle;
  302.  
  303.        //Constructor for a Boston Admin.
  304.         public BostonAdmin(String EmployeeName, String EmployeeRole, String EmployeeSSN, int SpecialEmployee, String RaceAbbreviation) {
  305.             super(EmployeeName, EmployeeRole, EmployeeSSN, SpecialEmployee, RaceAbbreviation);
  306.         }
  307.  
  308.         //Updates The int that defines the Special Employee. Please Note: After updating, Calculations for Salary, Tax, and Fed tax must be run again.
  309.         public void UpdateSpecialInfo(int UpdatedInfo){
  310.             UpdatedInfo = SpecialEmployee;
  311.         }
  312.  
  313.         //Calculates the title based on the level of Executive
  314.         public String calcPositionTitle(){
  315.             if(EmployeeRole.equals("Senior_Exec")){
  316.                 PositionTitle = "Senior Executive";
  317.             }
  318.             else if(EmployeeRole.equals("Junior_Exec")){
  319.                 PositionTitle = "Junior Executive";
  320.             }
  321.             else if(EmployeeRole.equals("Support")){
  322.                 PositionTitle = "Support";
  323.             }
  324.             return PositionTitle;
  325.         }
  326.  
  327.         //Calculates the Base Salary of an executive
  328.         public double calcBaseSalary(){
  329.             if(EmployeeRole.equals("Senior_Exec")){
  330.                 BaseSalary = 400000;
  331.             }
  332.             else if(EmployeeRole.equals("Junior_Exec")){
  333.                 BaseSalary = 175000;
  334.             }
  335.             else if(EmployeeRole.equals("Support")){
  336.                 BaseSalary = 40000;
  337.             }
  338.             return BaseSalary;
  339.         }
  340.  
  341.         //Calculates the Bonus for an Executive (If any)
  342.         public double calcBonus(){
  343.             if (SpecialEmployee == 1){
  344.                 Bonus = 0.20;
  345.             }
  346.             else if (SpecialEmployee == 2){
  347.                 Bonus = 0.10;
  348.             }
  349.             else {
  350.                 Bonus = 0.0;
  351.             }
  352.             return Bonus;
  353.         }
  354.  
  355.         //Calculates the Salary of an Executive
  356.         public void CalcSalary() {
  357.             Salary = calcBaseSalary()+ (calcBaseSalary() * BostonCOLA)+ (calcBaseSalary() * calcBonus());
  358.         }
  359.  
  360.         //Calculates State Taxes
  361.         public void CalcStateTax() {
  362.             StateTax = Salary * MassStateTax;
  363.         }
  364.         //Calculates the Federal taxes
  365.         public void CalculateFedTax() {
  366.             FedTax = Salary * FederalTax;
  367.         }
  368.  
  369.  
  370.  
  371.         //Getters for Boston Admin.
  372.         public double getStateTax() {
  373.             return StateTax;
  374.         }
  375.  
  376.         public double getFedTax() {
  377.             return FedTax;
  378.         }
  379.  
  380.  
  381.         public double getSalaryPostBonus(){
  382.             return SalaryPostBonus;
  383.         }
  384.        
  385.         //Prints a Boston Admins Information.
  386.         public void Print(){
  387.             System.out.println("\n Name: " + EmployeeName + "\n Boston Administrator "+"\n Position: " + calcPositionTitle()+"\n Race: "+EmployeeFullRace(RaceAbbreviation)+"\n SSN: " + EmployeeSSN + "\n Salary Base: "+calcBaseSalary() + "\n Cola (15%) " + (calcBaseSalary() * BostonCOLA)+"\n Bonus Amount: $" + (calcBaseSalary()*calcBonus())+"\n Total Salary: $" + getSalary()+"\n Estimated Taxes " +"\n Federal Taxes: $" + FedTax + "\n State Taxes: $" + StateTax);
  388.         }
  389.  
  390.  
  391.     }
  392.  
  393.     //The Boston Nurse Class is used to assign the role of a Nurse to an employee that lives in Boston
  394.     public class BostonNurse extends StaffCategories {
  395.         double BaseSalary = 65000;
  396.         double Bonus = 0;
  397.         double StateTax = 0;
  398.         double FedTax = 0;
  399.         String PositionTitle;
  400.  
  401.  
  402.         //Constructor for a Boston Nurse.
  403.         public BostonNurse(String EmployeeName, String EmployeeRole, String EmployeeSSN, int SpecialEmployee, String RaceAbbreviation) {
  404.             super(EmployeeName, EmployeeRole, EmployeeSSN, SpecialEmployee, RaceAbbreviation);
  405.         }
  406.  
  407.         //Updates The int that defines the Special Employee. Please Note: After updating, Calculations for Salary, Tax, and Fed tax must be run again.
  408.         public void UpdateSpecialInfo(int UpdatedInfo){
  409.             UpdatedInfo = SpecialEmployee;
  410.         }
  411.  
  412.         //Calculates the Position Title of a Nurse, based on their Special Employee information.
  413.         public String calcPositionTitle(){
  414.             if(SpecialEmployee == 1){
  415.                 PositionTitle = "Clinical Nurse";
  416.             }
  417.             else if(SpecialEmployee == 2){
  418.                 PositionTitle = "Hospital Floor Nurse";
  419.             }
  420.             else if(SpecialEmployee == 3){
  421.                 PositionTitle = "Hospital Administrative Nurse";
  422.             }
  423.             return PositionTitle;
  424.         }
  425.        
  426.         //Calculates The bonus a nurse recieves based on their SpecialEmployee int.
  427.         public double calcBonus(){
  428.             if(SpecialEmployee == 1){
  429.                 Bonus = 0.10;
  430.             }
  431.             else if(SpecialEmployee == 2){
  432.                 Bonus = 0.15;
  433.             }
  434.             else if(SpecialEmployee == 3){
  435.                 Bonus = 0.20;
  436.             }
  437.             return Bonus;
  438.         }
  439.        
  440.         //Calculate the Salary of a Nurse.
  441.         public void CalcSalary() {
  442.             Salary = BaseSalary+(BaseSalary * BostonCOLA)+ (BaseSalary * calcBonus());
  443.         }
  444.  
  445.  
  446.         //Calculate the state taxes of a nurse.
  447.         public void CalcStateTax() {
  448.             StateTax = Salary * MassStateTax;
  449.         }
  450.  
  451.         //Calculate the Federal taxes of a nurse.
  452.         public void CalculateFedTax() {
  453.             FedTax = Salary * FederalTax;
  454.         }
  455.  
  456.  
  457.  
  458.         //Getters for Boston Nurse.
  459.         public double getStateTax() {
  460.             return StateTax;
  461.         }
  462.  
  463.         public double getFedTax() {
  464.             return FedTax;
  465.         }
  466.        
  467.         //Prints the information for a Boston Nurse.
  468.         public void Print(){
  469.             System.out.println("\n Name: " + EmployeeName + "\n Position: Boston " + EmployeeRole +"\n Specialization: "+ calcPositionTitle()+ "\n Race: "+EmployeeFullRace(RaceAbbreviation) + "\n SSN: " + EmployeeSSN + "\n Base Salary: " + BaseSalary+ "\n COLA (15%) $" + (BaseSalary * BostonCOLA)+"\n Bonus Amount: $" + (BaseSalary * calcBonus())+"\n Total Salary: $"+ getSalary()+"\n Estimated Taxes "+ "\n Federal Taxes: " + FedTax + "\n State Taxes: " + StateTax);
  470.         }
  471.  
  472.  
  473.     }
  474.  
  475.  
  476.  
  477.     //The Boston Doctor Class is used to assign the role of a Doctor to an employee that lives in Boston.
  478.     public class BostonDoctor extends StaffCategories{
  479.         double BaseSalary = 155000;
  480.         double PatientAdjustment = 0.0025;
  481.         double StateTax = 0;
  482.         double FedTax = 0;
  483.  
  484.  
  485.         //Constructor for a Boston Doctor.
  486.         public BostonDoctor(String EmployeeName, String EmployeeRole, String EmployeeSSN, int SpecialEmployee, String RaceAbbreviation) {
  487.             super(EmployeeName, EmployeeRole, EmployeeSSN, SpecialEmployee, RaceAbbreviation);
  488.         }
  489.  
  490.         //Updates The int that defines the Special Employee. Please Note: After updating, Calculations for Salary, Tax, and Fed tax must be run again.
  491.         public void UpdateSpecialInfo(int UpdatedInfo){
  492.             UpdatedInfo = SpecialEmployee;
  493.         }
  494.  
  495.         //The CalcSalary Method will calculate a Boston Doctors Salary, accounting for COLA and their Individual adjusments
  496.         public void CalcSalary() {
  497.             Salary = BaseSalary + (BaseSalary * BostonCOLA) + (BaseSalary * PatientAdjustment * SpecialEmployee);
  498.         }
  499.  
  500.         //Calculates the State Tax
  501.         public void CalcStateTax() {
  502.             StateTax = Salary * MassStateTax;
  503.         }
  504.  
  505.         //Calculates the Federal Tax
  506.         public void CalculateFedTax() {
  507.             FedTax = Salary * FederalTax;
  508.         }
  509.  
  510.         //Prints the information for a Doctor in Boston
  511.         public void Print() {
  512.             System.out.println("\n Name: " + EmployeeName + "\n Position: Resident Boston " + EmployeeRole + "\n Race: " + EmployeeFullRace(RaceAbbreviation) + "\n SSN: " + EmployeeSSN + "\n Patient Count: " + SpecialEmployee + "\n Salary Base: $" + BaseSalary + "\n COLA(15%): $" + (BaseSalary * BostonCOLA) + "\n Patient Adjustment: $" + (BaseSalary * PatientAdjustment * SpecialEmployee) + "\n Total Salary: $" + Salary + "\n Estimated Taxes " + "\n Federal Taxes: $" + getFedTax() + "\n Mass State Taxes: $" + getStateTax());
  513.         }
  514.  
  515.  
  516.  
  517.  
  518.  
  519.         //Getters for Taxes
  520.  
  521.         public double getStateTax() {
  522.             return StateTax;
  523.         }
  524.  
  525.         public double getFedTax() {
  526.             return FedTax;
  527.         }
  528.  
  529.  
  530.     }
  531.  
  532.     //The StaffCategories class establishes the categories that will be used when considering an employee and their pay.
  533.     public abstract class StaffCategories extends RegionalCities {
  534.         public int SpecialEmployee;
  535.  
  536.        
  537.         //Constructor for Staff Categories. Introduces and sets the Special Employee field
  538.         public StaffCategories(String EmployeeName, String EmployeeRole, String EmployeeSSN, int SpecialEmployee, String RaceAbbreviation) {
  539.             super(EmployeeName,EmployeeRole, EmployeeSSN, RaceAbbreviation);
  540.             setSpecialEmployee(SpecialEmployee);
  541.         }
  542.  
  543.         //Setter for Special Employee
  544.         public void setSpecialEmployee(int SpecialEmployee) {
  545.             this.SpecialEmployee = SpecialEmployee;
  546.         }
  547.  
  548.         //Getter for SpecialEmployee
  549.         public int getSpecialEmployee() {
  550.             return SpecialEmployee;
  551.         }
  552.     }
  553.  
  554.     //The RegionalCites class establishes the state and city taxes for each state and city.
  555.     public abstract class RegionalCities extends The_WLFU_Team {
  556.         public double BostonCOLA = 0.15;
  557.         public double MassStateTax = 0.05;
  558.         public double FederalTax = 0.25;
  559.  
  560.        
  561.         //Constructor for Regional Cities.
  562.         public RegionalCities(String EmployeeName, String EmployeeRole, String EmployeeSSN, String RaceAbbreviation) {
  563.             super(EmployeeName, EmployeeRole, EmployeeSSN, RaceAbbreviation);
  564.         }
  565.  
  566.  
  567.         //Getters for RegionalCities
  568.         public double getBostonCOLA() {
  569.             return BostonCOLA;
  570.         }
  571.  
  572.         public double getMassStateTax() {
  573.             return MassStateTax;
  574.         }
  575.  
  576.         public double getFederalTax() {
  577.             return FederalTax;
  578.         }
  579.  
  580.  
  581.     }
  582.  
  583.     //The class The_WLFU_Team is an extension of Employee. If we had staff outside of Boston, they'd be held together here.
  584.     public abstract class The_WLFU_Team extends Employee {
  585.        
  586.         //Constructor for The_WLFU_Team
  587.         public The_WLFU_Team(String EmployeeName, String EmployeeRole, String EmployeeSSN, String RaceAbbreviation) {
  588.             super(EmployeeName, EmployeeRole, EmployeeSSN, RaceAbbreviation);
  589.         }
  590.  
  591.     }
  592.  
  593.     //The Employee class is the base class for the entire structure. Since everyone in hospital staff is an employee it all starts here
  594.     public abstract class Employee implements Comparable<Employee> {
  595.         String EmployeeName;
  596.         String EmployeeRole;
  597.         String EmployeeSSN;
  598.         String RaceAbbreviation;
  599.         double Salary;
  600.  
  601.         //Abstract Methods for their later use
  602.         abstract void UpdateSpecialInfo(int UpdatedInfo);
  603.         abstract void CalcSalary();
  604.         abstract void CalcStateTax();
  605.         abstract void CalculateFedTax();
  606.         abstract void Print();
  607.  
  608.  
  609.  
  610.         //Translating RaceAbbreviation into the full race name.
  611.         public String EmployeeFullRace(String RaceAbbreviation) {
  612.             String FullRace = null;
  613.             if (RaceAbbreviation.equals("AA")) {
  614.                 FullRace = "African American";
  615.             } else if (RaceAbbreviation.equals("AS")) {
  616.                 FullRace = "Asian";
  617.             } else if (RaceAbbreviation.equals("CA")) {
  618.                 FullRace = "Caucasian";
  619.             } else if (RaceAbbreviation.equals("HS")) {
  620.                 FullRace = "Hispanic";
  621.             } else if (RaceAbbreviation.equals("OT")) {
  622.                 FullRace = "Other";
  623.             }
  624.             return FullRace;
  625.         }
  626.         //CompareTo so that an Employee can be sorted from largest to smallest based on Total Salary
  627.         public int compareTo(Employee o) {
  628.             if (getSalary() >  o.getSalary()) return 1;
  629.             else if (getSalary() <  o.getSalary()) return -1;
  630.             else return 0;
  631.         }
  632.  
  633.         //Constructor for an Employee
  634.         public Employee(String EmployeeName, String EmployeeRole, String EmployeeSSN, String RaceAbbreviation) {
  635.             setEmployeeName(EmployeeName);
  636.             setEmployeeRole(EmployeeRole);
  637.             setEmployeeSSN(EmployeeSSN);
  638.             setRaceAbbreviation(RaceAbbreviation);
  639.             setSalary(Salary);
  640.         }
  641.  
  642.         //Setters for the Employee Class.
  643.         public void setEmployeeName(String EmployeeName) {
  644.             this.EmployeeName = EmployeeName;
  645.         }
  646.  
  647.         public void setEmployeeRole(String EmployeeRole){this.EmployeeRole = EmployeeRole;}
  648.  
  649.         public void setEmployeeSSN(String EmployeeSSN) {
  650.             this.EmployeeSSN = EmployeeSSN;
  651.         }
  652.  
  653.         public void setRaceAbbreviation(String RaceAbbreviation) {
  654.             this.RaceAbbreviation = RaceAbbreviation;
  655.         }
  656.  
  657.         public void setSalary(double Salary){this.Salary = Salary;}
  658.  
  659.  
  660.  
  661.         //Getters for the Employee Class.
  662.         public String getEmployeeName() {
  663.             return EmployeeName;
  664.         }
  665.  
  666.         public String getEmployeeSSN() {
  667.             return EmployeeSSN;
  668.         }
  669.  
  670.         public String getRaceAbbreviation() {
  671.             return RaceAbbreviation;
  672.         }
  673.  
  674.         public double getSalary() {
  675.             return Salary;
  676.         }
  677.  
  678.         public String getEmployeeRole(){return EmployeeRole;}
  679.  
  680.     }
  681. }
Add Comment
Please, Sign In to add comment