Anda di halaman 1dari 4

October 18, 2017 [COMP 1502 A4 PAYROLL SYSTEM]

Date given: Wednesday November 8, 2017


Date due: Wednesday Nov 29, 2017 at noon (i.e. just before the lecture starts)
Weight: 7% of your course grade

1 Overview
What you will be making: You will be making a system that will keep track of different types of
employees.

Assignment Objectives:
Design, Implement and Test a fully working program.
More practice with Java file input and output.
Demonstrate your understanding of inheritance polymorphism.
Enhance your Object Oriented design using packages.
Use exceptions to catch input errors and take corrective action.
Construct a non-trivial but still basic human interface;

What you will need to hand in:


All your compiled and working source code
Your completed test plan

How to hand your assignment in:


Put everything in a folder (named LastName_FirstName_A4) and put it into the submit drive.

Note: Read the entire assignment before starting anything!


You may use either Arrays of Objects or ArrayLists

2 Basic system requirements


A company wants a program that allows personnel in HR to go online and manage their employees.
The system needs to allow the user to add employee information, change it, and generate reports.
The system needs to save the information quits so that all the information is restored when the
system is restarted.

3 Design Requirements
1. The classes must be organized into Java packages.
2. The employee information must held in objects using inheritance.
3. Object persistence must be accomplished using inheritance polymorphism (i.e. there cannot be
completely separate methods to load and unload the different types of employees).

4 More detailed system requirements

Page 1 of 4
October 18, 2017 [COMP 1502 A4 PAYROLL SYSTEM]

4.1 Object Persistence Requirements


All persistent data will be kept text files in a folder called database. You make the files and
filenames you see fit. These names should be kept in the program in some way. The names
should NOT be entered in the command line or via the console. The files will be read in to the
appropriate objects at the start of the session and written out to the appropriate files at the end
of the session.

4.2 Object Model


The following entities must be implemented as objects with the appropriate properties and
behaviours.

Employees

The company has three types of employees: Hourly, Salary, and Commission. The table below
describe each type of employee

Hourly Properties Salary Properties Commission Properties


name name name
social insurance number social insurance number social insurance number
department department department
hourly pay rate yearly salary number of weeks since
hours worked this week start of year or employment
base weekly salary
sales this year but not
including this week (in $)
commission rate

Hourly Methods Salary Methods Commission Methods


1. Constructor Constructor Constructor
2. gets and sets for all data gets and sets for all data gets and sets for all data, but
no set for the sales field
3. double calcWeeklySalary () double calcWeeklySalary () double calcWeeklySalary ()
4. boolean equals (Employee e) boolean equals (Employee e) boolean equals (Employee e)
5. boolean topSeller ()
6. String packData String packData String packData
7. unpackData unpackData unpackData

Notes (numbers match methods above):


1. Constructor takes all required fields. For commission rates, the rates should be represented
as a number, not percentage. For example, 2.5% rate should be represented by 2.5.
Represent money as doubles not currency. There may be different loading and on-line
constructors.
2. Normal gets and sets for the class.
3. Calculates the weekly salary, as follows:
a. Hourly employees are paid by the hour determined by the number of hours worked
multiplied by the hourly rate. However for hours worked beyond 40, they are paid
time and a half.
Page 2 of 4
October 18, 2017 [COMP 1502 A4 PAYROLL SYSTEM]

b. Salary employees get 1/52 of yearly salary.


c. Those on commission earn base salary plus commission paid on weekly sales,
determined by multiplying weekly sales by commission rate.
4. Determines if 2 employees are the same by comparing social insurance numbers
5. A person is a member of the Top Sellers Club if the sales this year are more than $1,500 /
week. This includes all weeks from the beginning of the year.
6. This assembles all the information about the employee into a string to be output to the
appropriate file. This file will serve as the input file for next week.
7. This takes the output of 6 and splits it into the original fields.

Since this implementation has a superclass and subclasses, some of what is listed above may be in the
superclass only, some in subclasses only, some may need to be in both. You will need to decide to
which classes each method belongs to. In addition, you may need to add methods in the superclass that
are overridden in the subclass. You may give your methods different names than the names above You
will probably need additional methods.

Special requirement: Since you are using subclasses there must not be a Type field. For example, do
NOT have a field in the employee object with value H for hourly employees. The type of an employee is
determined by the subclass you create.

4.3 User Interface Requirements


The program presents a menu for the user to work with payroll. It has the following options: (Note:
the SIN is used to identify the employee uniquely). Before the menu can be used, the personnel
ArrayList must be populated from a datafile. Normally, this datafile is created by the previous
weeks payroll processing. The previous week processing resets the number of hours worked for
Hourly employees to 0 and the weekly sales for Commission employees to 0.0. Thus, you will need
to request the user to enter these values for this week.

A adds a new employee (must check that employee not already in the personnel list)
I once a valid social insurance number is entered, prints out the information about an
employee
D once a valid social insurance number is entered, this displays the employees name social
insurance number and asks the user to verify deleting the employee. If they enter Y, the
employee is then deleted. Otherwise, no action is taken and returns to the main menu.
S once a valid social insurance number is entered, this calculates and prints the weekly
salary for an employee
T this prints the list of Commission employees who are topSellers showing at least the name
sin and sales
P this prints the weekly salary report for all the employees. It should be similar to:
Arnold 123-456-789 Hourly $ 625.00
Beatrice 222-333-444 Salary $ 750.00
Charles 555-777-666 Commission $ 672.35

Q Quit the program (must export the employee files )

Page 3 of 4
October 18, 2017 [COMP 1502 A4 PAYROLL SYSTEM]

4.4 Application Design Requirements


You will need to make more than one class to handle the employee information. You will also need
to make more than one class to handle user interaction. These groups of classes need to be managed
with java packages.

4.5 Error Handling Requirements


There is the possibility of errors in the data loading as well as user interaction parts of the program.
These must be handled with exceptions.

5 What you should do


1. Download the assignment folder from the resource drive and rename the folder
<last name>_<first name>_Asg_4
2. There is a test requirements document in the folder it indicates functionality required in your program
3. There is a test plan document in the folder use as a template to make the test plans that will show that
your code works
4. If you do not make a useable test plan your functionality wont be marked
5. Then start programming your assignment. Test your code with the test plan!

6 How the assignment will be marked


You will hand in your test plan. Each of the test requirements that is covered by the test plan will be
given the number of points in the test requirements document. When your assignment is being
marked your professor will follow your test plan. If the test requirement is met you will get the mark.
Note that if a requirement is not covered by the test plan then it will not be tested and no mark will be
given. Note also that if you dont hand in the test plan you effectively will get no marks for
functionality.

Weight of aspects of the assignment


Functionality (as determined by the test plan) 50%
Application and code design 50%

See the Marking Master document for more details

Page 4 of 4