MCS-178 Mini Project 7: An Introduction to Object-oriented Programming
(for practice, not for grading)
Overview
For this mini project, you need to implement a Employee interface along with three classes.The UML diagram for the class structure that you will be implementing (version 2).
Specific tasks
The
Employee interface has the methods toString and pay
The HourlyEmployee class
has the methods addHours(double hours), which will add hours to the totalHours worked, pay() will print their pay for that time period and reset
their hours to zero, setShift(String shift) will set thier work shift and toString() will return the string representation for an employee.
The constructors are
HourlyEmployee(String name, String title, int id, double wage), which create an hourly employee with the specified values on the "day" shift. and
HourlyEmployee(String name, String title, int id, double wage, String shift), which create an hourly employee with the specified values on the given shift.
The PartTimeEmployee class is a subclass of HourlyEmployee and the constructor has the form PartTimeEmployee(String name, int id) which takes the given arguments and creates the super with title of "part time" and starting wage partTimeWage. partTimeWage is a private static double within PartTime employee with a value of 10.00.
The SalariedEmployee class has the constructor SalariedEmployee(String name, String title, int id, double salary) which sets the appropriate instance variables. It also has the methods toString() which returns the object as a string and pay(double taxRate) which returns the current pay for this time period which is salary * (1 - taxRate)
You are also given a test file of testing.java which creates instances of each object, prints out the current list of employees, some simple operations on them. The result you see when running this test file should be the same as those in the comments in the test file. This file can be found at
The four files you hand in should be Employee.java, HourlyEmployee.java, SalariedEmployee.java and PartTimeEmployee.java.