Assignment #4: Springfield Company
This time you're on your own: no pre-programmed modules - and no graphics !
Assume a company having 3 types of employees:
- consultants
- secretaries and
- executives.
Consultants are payed by rate per hour(RPH) , having no base salary (BS).
Secretaries only have a base salary, whereas executives receive a base salary (BS) plus additional bonus
of a percentage of their salary (BP) (...as in reality: no matter if they deserve it).
Secretaries and executives are not receiving any payments per hour.
These are the employees:
- Maggie, consultant, RPH = 100, hours per month: 70
- Moe, consultant, RPH = 150, hours per month: 90
- Maud, consultant, RPH = 200, hours per month: 20
- Bart, secretary, BS: 4000
- Ned, secretary, BS: 5000
- Marge, secretary, BS: 5100
- Homer, executive, BS: 12000, BP: 10%
- Lisa, executive, BS: 15000, BP: 8%
Write a program that lists all names, the monthly income and the sum of all monthly incomes.
This program MUST take advantage of the structure of the given data, i.e.:
there must be the classes:
- SpringfieldCompany, containing only the static main - method (see below)
- Employee, an abstract class, defining the abstract method getMonthlyIncome() as well
as all other methods / fields all employees have in common
- Consultant, derived from Employee
- Secretary, derived from Employee
- Executive, derived from Employee
The main method, placed in the class springfieldCompany, MUST contain the employees in an Employee-ARRAY:
Employee theEmployees[ ] = new Employee[8]
This array MUST be used to compute the output, i.e. you have to go through the array in order to print the names,
the income and the sum of all monthly incomes.
You can earn 1 bonus point if Bart Simpson shows up every time you start the program, using the graphic program
from assignment 3. You might need triangles for that, though.
You can earn 5 (!) Bonus points if you incorporate the graphic program of assignment 3 into this assignment,
showing a graphic for each secretary (Marge MUST have blue hair), the data necessary being stored in the secretary class !