I need help creating a driver, payroll, and employee class. ObjectList & ObjectL
ID: 666048 • Letter: I
Question
I need help creating a driver, payroll, and employee class. ObjectList & ObjectListNode are already made.
Linked List Assignment: Construct a java program that will retrieve, update and manipulate a small payroll database.
Note that each line in the file, payfile.txt, contains a field for
- firstName
- lastName
- gender
- tenure
- rate
- salary
1. Read each line of data from payfile.txt, place the data into an Employe object, and insert the Employee object onto the end of an ObjectList.
2. Traverse the list and output the contents of the info field of each ObjectListNode into an easily read table format with each field appropriatley labeled.
3. Traverse the list and output the contents of the info field of each ObjectListNode into an easily read table format with each field appropriately.
4. Traverse the list and output the number of employees.
5. Traverse the list and output the first name of all women on payroll
6. Traverse the list and output the first and last names and salary of all weekly employees who make more than $35,000 per year year and who have been with the company for at least five years.
7. Traverse the list and 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 employees on the payroll who has recieved a raise.
8. Sort the nodes of the linked list into alphabetical order according to last name and print the first and last names and salaries for each employee on the payroll.
9. The file hirefile.txt conatins 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 for each employee on the payroll.
10. The firefile.txt contains data for two employees to be fired 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.
Leave comments on your codes as well.
Use 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
- Comparable(interface)
- Driver (main class)
- Payroll
- Employee
hirefile.txt
firefile.txt
Note: Here's a rather simple algorithm to sort a linked list. Assume list points to an unsorted list and sortList points to NULL.
while list != null
remove first node from list
insert node into correct location in sortList
list = sortList
I have ObjectList Class made
I have ObjectList already made as well
Explanation / Answer
package employeeDB;import javax.persistence.*; @Entity publicclass Employee { @Id String name; Double salary; public Employee() { } public Employee (String name, Double Salary) { this.name=name; this.salary=Salary; } publicvoid setSalary(Double Salary) { this.salary=Salary; } publicString toString() { return"Name: "+name+" Salary: "+salary ; } } package employeeDB; import javax.persistence.*; import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { /** * Displays all Employees in the Database */ private static void displayAll() { em.getTransaction().begin(); TypedQuery e=em.createQuery(displayAllQuery, Employee.class); List employees=e.getResultList(); if(employees.size()>0) { for(Employee temp:employees) { System.out.println(temp); System.out.println(); } System.out.println(employees.size()+" Employee Records Available...!"); } else System.out.println("Database is Empty!"); em.getTransaction().commit(); } /** * Insets an Employee into the Database. */ private static void insert() { System.out.print("Enter the number of Employees to be inserted: "); n=input.nextInt(); em.getTransaction().begin(); for(int i=0;iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.