Lab 13: Payroll Processing Part 1

Objectives

Resources

Introduction

In this Lab you will practice using Exceptions with a basic simulated payroll management system and user input. In the next Lab, you will expand the payroll management system to include deductions and timesheet information as well as read and write data to files.

You have been provided JavaDoc for the primary classes in this assignment. Below are additional details regarding the user input, how the different exceptions should be handled, and a sample output.

User Input

The user will enter information for each Employee one line at a time. Each entry will contain a series of elements separated by a colon of the form, id: name: address: type: value1: value2. These elements are used to create an instance of an Employee (FullTime or Hourly). The type element indicates the type of Employee with valid values being "hourly" or "fulltime". If the type is hourly, value1 and value2 correspond to the hourly rate and how many hours the employee has worked. If the type is "fulltime", value1 is the yearly salary and value2 is 0 and not used. See the sample output.

After each entry, the user should be asked if they want to enter information for another Employee. If a user enters incorrect information, the program should print a descriptive message of the issue and skip that entry.

Exceptions

Many different types of Exceptions can occur in this program. For some methods, an Exception will cause the method to terminate and return to whatever called it. For some methods, an Exception will cause you to skip some operation and move onto the next. See the JavaDoc for how the different methods should handle Exceptions.

Sample Output

Enter the information for employee 1 in the form of:
id: name: address: type: value1: value2 
11: Robin B. Fly: 2482 Dewey Lane: hourly: 17.50: 100

Employee Information
	ID:                             11
	Name:                 Robin B. Fly
	Address:           2482 Dewey Lane
	Type:                       Hourly
	Rate:                        17.50

Do you want to enter information for another employee (y/n)
y
Enter the information for employee 2 in the form of:
id: name: address: type: value1: value2 
2: Pete Moss: 18th N ViewWay: fulltime: 48000: 0

Employee Information
	ID:                              2
	Name:                    Pete Moss
	Address:            18th N ViewWay
	Type:                     Fulltime
	Salary:                   48000.00

Do you want to enter information for another employee (y/n)
y
Enter the information for employee 3 in the form of:
id: name: address: type: value1: value2 
4: Max Payne: 2482 Dewey Lane: hourly: 15.00: 225

Employee Information
	ID:                              4
	Name:                    Max Payne
	Address:           2482 Dewey Lane
	Type:                       Hourly
	Rate:                        15.00

Do you want to enter information for another employee (y/n)
y
Enter the information for employee 4 in the form of:
id: name: address: type: value1: value2 
7: Sam Delison: 1111 Provolone Street: hourly: 1S.00: 225

Error parsing Employee data 
For input string: "1S.00"

Do you want to enter information for another employee (y/n)
y
Enter the information for employee 4 in the form of:
id: name: address: type: value1: value2 
3: Jake Smith: 8212 Lost Road Blvd.: commission: 0.01: 1000

Error with Employee arguments
Invalid Employee type: commission

Do you want to enter information for another employee (y/n)
y
Enter the information for employee 4 in the form of:
id: name: address: type: value1: value2 
8: Lily Pondwater: 1821 E FrogWay Lane: fulltime

Error with the number of Employee arguments 
Index 4 out of bounds for length 4

Do you want to enter information for another employee (y/n)
y
Enter the information for employee 2 in the form of:
id: name: address: type: value1: value2 
4: Max Payne: 2482 Dewey Lane: hourly: 15.00: 225

Error, entered employee already exists in list. 

Do you want to enter information for another employee (y/n)
y
Enter the information for employee 4 in the form of:
id: name: address: type: value1: value2 
0: Kevin Ortiz: 12 HillSide Lane: hourly: 22.50: 10

Error with Employee arguments: 
Invalid arguments for Employee: 0: Kevin Ortiz: 12 HillSide Lane

Do you want to enter information for another employee (y/n)
y
Enter the information for employee 4 in the form of:
id: name: address: type: value1: value2
13: Michelle Jones: 43 EastWay PL: hourly: -10.50: 10

Error with Employee arguments: 
Rate for Hourly should be positive.

Do you want to enter information for another employee (y/n)
n

Paystubs:

Employee Information
	ID:                             11
	Name:                 Robin B. Fly
	Address:           2482 Dewey Lane
	Type:                       Hourly
	Rate:                        17.50
Payment Details:
	Rate:                         17.50
	Hours:                       100.00
	Gross Pay:                  1750.00

Employee Information
	ID:                              2
	Name:                    Pete Moss
	Address:            18th N ViewWay
	Type:                     Fulltime
	Salary:                   48000.00
Payment Details:
	Salary:                   48000.00
	Gross Pay:                 2000.00

Employee Information
	ID:                              4
	Name:                    Max Payne
	Address:           2482 Dewey Lane
	Type:                       Hourly
	Rate:                        15.00
Payment Details:
	Rate:                         15.00
	Hours:                       225.00
	Gross Pay:                  3375.00

Acknowledgment

This laboratory assignment was developed by Dr. Adela Velez.

See your professor's instructions for details on submission guidelines and due dates.