Project 3 - Data Processing
Due - Friday, March 23, 2007
The goal of this project is to give you experience with
object-oriented design an inheritance. You will write a payroll
processing program that calculates the pay for several types of
employees.
Your program will begin by reading from a file information about
all employees of the organization. The organization will have
three types of employees: staff, faculty, and students. Each
Faculty entry will contain the following information:
- The name of the faculty member.
- The yearly salary of the faculty member.
- The medical plan for the faculty member. This field with have the value Kaiser or the value Blue Cross.
- The monthly retirement contribution of the faculty member.
- The faculty member's total retirement contribution so far for the current year.
Each Staff entry will contain the same fields as the Faculty entry with the following additions:
- The number of vacation days the staff member has taken during the current pay period.
- The number of vacation days the staff member has taken for the current year, up to but not including the current pay period.
Each Student entry will contain the following information:
- The name of the student.
- The per hour wage of the student.
- The total number of hours worked for the current pay period.
- The total number of hours worked so far for the current year.
The file employeedb.xml
contains an example input file. Note, the input will be in XML
format. For full credit, your program must correctly process
files in the format given.
Your program will read in a file containing employee information
and build an ArrayList of objects, each containing information
about a particular employee. The ArrayList will be stored in an
EmployeeDB class. The EmployeeDB will provide methods to calculate
the payroll for the organization and provide output about various
properties of the employees. For full credit, you must implement
at least the following classes.
EmployeeDB - EmployeeDB contains an ArrayList of Employee objects. It also provides the following methods:
- buildDB - This method takes as input a file name, parses the file, and builds and ArrayList of Employee objects. As this method parses the file, it ensures that the file is correctly formatted and that the data it contains is valid.
- calculateWages - This method calculates the pay for each employee and stores the result in a data member in each Employee object.
- exportDB - This method writes to a file information about each Employee. The format of the file should look like the input file with one addition. Each Staff/Faculty/Student entry will have one additional field containing the pay for the pay period. An example would look as follows: <Pay>2376.45</Pay>
- exportMaxedRetirementContribution - This method writes to a file information about each salaried Employee whose total retirement contribution to date has reached $15000. The format of the file should be the same as the format of the file exported by the exportDB method.
- exportMaxedHoursWorked - This method writes to a file information about each hourly Employee who has exceeded 480 total hours to date. The format of this file should be the same as the format of the file exported by the exportDB method.
- exportMaxedVacation - This method writes to a file information about each Staff member who has exceeded 20 days of vacation time. The format of this file should be the same as the format of the file exported by the exportDB method.
Employee - Employee is an abstract class that represents
information about an employee. You should include appropriate
data members in this class, as well as an abstract method
calculatePay. Finally, you should include any methods that
may be used by all subclasses of Employee.
Faculty - Faculty is a subclass of Employee that represents
information about a faculty member. To calculate the pay for a
faculty member, first divide the faculty's yearly salary by 12 to
get the base pay. Second, deduct the faculty member's retirement
contribution. Third, deduct the contribution for health
insurance; deduct $25 for Kaiser coverage and $50 for Blue Cross
coverage. Fourth, deduct taxes based on the following schedule:
Yearly Salary | Tax Rate |
$0-$7500 | 10% |
$7501-$25000 | 15% |
$25001-$75000 | 20% |
$75001-$150000 | 25% |
$150001- | 30% |
Staff - Staff is a subclass of Employee that represents
information about a staff member. Calculate the pay for a staff
member in the same way you calculate the pay for a faculty member.
Make sure that you also appropriately update the total vacation
time taken by the staff member.
Student - Student is a subclass of Employee that represents
information about a student. To calculate the pay for a student,
multiply the wage times hours worked and then deduct the
appropriate tax using the schedule you used for the faculty and
staff. To determine the projected annual wage, multiply the
current pay by 12.
You are encourage to expand this design by adding additional
methods and/or classes. For example, you might consider using an
abstract SalariedEmployee class and an abstract HourlyEmployee
class. Faculty and Staff would then inherit from SalariedEmployee
and Student would inherit from HourlyEmployee.
Make sure that you do not duplicate code. Whenever possible, use
inheritance to avoid redundancy. Points will be deducted for poor
design.
Due 9:40AM, Friday, March 23, 2007
- Complete and submit your working code. Turn in a hard copy in class and place a copy of your .java files in /home/submit/cs112-s07/username.
- Make sure that each function is well documented. Your documentation should specify the type and function of the input parameters and output.
- Run your program on a variety of inputs ensuring that all error conditions are handled correctly.
Note: No portion of your code may be copied from any other
source including another text book, a web page, or another
student (current or former). You must provide citations for any
sources you have used in designing and implementing your program.
Sami Rollins