Enterprise Systems Programming
Lab 2: Java and Inheritance

Instructions:
  1. Download this zip file containing an Eclipse workspace and project. Unzip it in your desktop. Note the ws folder that was extracted.
  2. Open the eclipse IDE (the version we have been using). Select File -> Import -> General -> Existing Projects into Workspace. Select the appropriate root folder: the ws folder you extracted in the previous step. The Lab2 project will be automatically selected. Click on Finish and Lab2 will be imported.
  3. The Eclipse project currently contains contains an Employee class and a tester class (CompanySimulation). Note that the Employee class is in the personnel package. In order for the tester class to compile and execute you will need to create two more classes.
  4. Create Java classes Manager and Secretary that are subclasses of Employee; these classes should also be part of the personnel package. A manager is an employee who has a bonus over and above his/her salary. A secretary is an Employee who reports to a boss. For Manager, you will need to define a 3-parameter constructor (indicating name, salary, and bonus) and a getBonus() method. For Secretary, you will need to define a 3-parameter constructor (indicating name,salary, and manager) and a getBossName() method. Execute CompanySimulation once you have created the classes (to execute from Eclipse, select Run->Run...->Java Application, choose CompanySimulation as the name of the main class, and then click on the Run button). The execution should produce the following output:
    Wayland's boss is Montgomery
    Montgomery has an additional bonus of 20000.0
    ----------
    Homer's salary is 10000.0
    Montgomery's salary is 100000.0
    Wayland's salary is 20000.0
    Carl's salary is 11111.0
    Lenny's salary is 12345.0
    ----------
    Salary of Homer is 10500.0
    Salary of Montgomery is 105000.0
    Salary of Wayland is 21000.0
    Salary of Carl is 11666.55
    Salary of Lenny is 12962.25
    
    Note: you will need to call the appropriate superclass constructor from the subclasses you wrote (use super(...) ).
  5. Using method overriding, arrange it so that a secretary gets a 10% salary increase instead of the usual 5% for employees in general. Also, arrange it so that when printing the salary package of a manager, print the manager's bonus. The output for CompanySimulation would now be:
    Wayland's boss is Montgomery
    Montgomery has an additional bonus of 20000.0
    ----------
    Homer's salary is 10000.0
    Montgomery's salary is 100000.0
    Wayland's salary is 20000.0
    Carl's salary is 11111.0
    Lenny's salary is 12345.0
    ----------
    Salary of Homer is 10500.0
    Salary of Montgomery is 105000.0 with a bonus of 20000.0
    Salary of Wayland is 22000.0
    Salary of Carl is 11666.55
    Salary of Lenny is 12962.25 with a bonus of 100.0
    
    Note: you will need to define and increaseSalary() method in Secretary and a printSalaryPackage() method in Manager.
  6. When you are done (when the output of your program matches the output in the previous item), quit Eclipse, go to your Eclipse workspace, locate the Lab2 folder and zip that into an archive called [idnumber]-Lab2.zip. You may still work in pairs but make sure you indicate both student names in the programs your wrote and have separate submissions. Submit through moodle .