Construct a Java program that will retrieve, update, and manipulate a small payroll database. The payroll data (payfile.txt), along with two additional files (hirefile.txt, firefile.txt) required can be found in the REQUIRED folder.
Note that each line in the file, payfile.txt, contains a field for:
The program should perform each of the operations indicated below. Be sure to clearly label the output for each section and be sure to properly format the output. Note that all salaries should be shown to two decimal places. Your program should send all output to a file called csis.txt.
a) Read each line of data from payfile.txt, place the data into an Employee object, and insert the Employee object onto the end of an ObjectList.
b) Output the contents of the infor field of each ObjectListNode into an easily read table format with each field appropriately labeled.
c) Output the numbers of employees
d) Output the first and last name of all women on the payroll.
e) Output the first and last names and salary of all weekly employees who make more than $35,000 per year and who have been with the company for at least five years.
f) Give a raise of $0.75 per hour to all employees who are paid on an hourly basis and make less than $10.00 per hour; and give a raise of $50.00 per week to all employees who are paid on a weekly basis and make less than $350.00 per week. Be sure to output the first and last names and new salaries for each employee on the payroll who has received a raise.
g) Sort the nodes of the linked list into alphabetical order according to last/first names and print the first and last names and salaries for each employee on the payroll.
h) The file hirefile.txt contains data for three employees to be hired by the company. Insert each of the new employees into the correct location in the sorted linear linked list and print the first and last names of each employee on the payroll.
i) The file firefile.txt contains data for two employees to be fire by the company. Delete the corresponding nodes in the sorted linear linked list for each of the employees to be fired and print the first and last names for each employee on the payroll.
Here are the data files for this project :
payfile.txt | |||
Howard | Starr | M 8 H | 30.00 |
Joan | Jacobus | F 9 W | 925.00 |
David | Renn | M 3 H | 4.75 |
Albert | Cahana | M 3 H | 18.75 |
Douglas | Sheer | M 5 W | 250.00 |
Shari | Buchman | F 9 W | 325.00 |
Sara | Jones | F 1 H | 7.50 |
Ricky | Mofsen | M 6 H | 12.50 |
Jean | Brennan | F 6 H | 5.40 |
Deborah | Starr | F 3 W | 1000.00 |
Jamie | Michaels | F 8 W | 150.0 |
hirefile.txt | |||
Barry | Allen | M 0 H | 6.75 |
Nina | Pinella | F 0 W | 425.00 |
Lane | Wagger | M 0 W | 725.00 |
firefile.txt | |||
Jean | Brennan | ||
Ricky | Mofsen |
Note 1: Classes
Be sure you use the ObjectListNode and ObjectList classes as well as the Comparable interface to allow you to make appropriate comparisons in the ObjectList class.
Your program should use at least the following classes:
ObjectListNode
ObjectList
Employee
Driver
Payroll
Note 2: Sorting a Linear Linked List
Here's a simple algorithm to sort a linear linked list:
while (list != null)
remove the first node
insert node into newList
list = newList
Note 3: Program Documentation
Note 4: Interfaces
Each data structure in the project must implement an interface for the data structure. The interface files must be included in the
Note 5: Class Diagram: Shown below is the class diagram for the solution see image.