Question: Purpose: After completing this assignment, you will have practiced using linked lists and linked list algorithms. Description For this assignment you will write a program
Purpose:
After completing this assignment, you will have practiced using linked lists and linked list algorithms.
Description
For this assignment you will write a program to simulate a payroll application. To that effect you will also create an Employee class, according to the specifications below. You will create a linked list of Employee objects to simulate a payroll program.
Specification for Employee class:
Attributes:
Employee ID: you can use a string the ID will contain digits and/or hyphens. The ID cannot be changed once an employee object is created.
Number of hours worked in a week: a floating-point number.
Hourly pay rate: a floating-point number that represents how much the employee is paid for one hour of work.
Gross wages: a floating-point number that stores the number of hours times the hourly rate.
Methods
A constructor (__init__)
Setter methods as needed.
Getter methods as needed.
This class should overload the __str__ or __repr__ methods so that Employee objects can be displayed using the print() function.
Specification for Node and LinkedList classes:
You will need to provide an implementation of the Node and the LinkedList classes. If you wish, you can re-use the code demoed during lecture but you will need to add a comment citing the source and you may need to modify it.
Script
Your main script will simulate a basic payroll system. There should be a menu with the following options:
Add new employee: this option allows you to enter the ID of a new employee and his/her hourly rate.
Calculate Weekly Wages: this option displays each employee ID and asks the user to enter the number of hours worked by each employee. The script should calculate the gross wages for each employee (hours times pay rate) and store the information in the corresponding node.
Display Payroll: this option displays each employees identification number, hours worked, hourly rate, and gross wages.
Update Hourly Rate: this option allows the user update the hourly rate of one employee. The user should enter the ID of the employee. If the ID exits in the list, then the hourly rate can be updated.
Remove Employee for payroll: this option allows the user to remove an employee. The user should enter the ID of the employee. If the ID exits in the list, then the employee can be removed from the list.
Quit the program
You will need a loop to show and process the menu until the user chooses to quit/exit the program.
Validation:
Each employee number should be unique. Do not accept duplicate employee numbers.
Do not accept negative numbers for hours worked.
Do not accept numbers less than 6.00 for pay rate
NOTE:
Please keep in mind that you are expected to write a good quality, well formatted program. That means:
User input must be validated and your program gracefully handle invalid inputs.
Repetitive code (code that appears in multiple places in the main script) should be written as a function.
Your program must use good style, including proper identifier names, useful comments, and proper use of indentation and whitespace.
You program should also have an appropriate user interface so that anyone one using the program knows what to do and what to expect.
For this assignment, you must submit a single zip (such as HW3.zip) file that contains:
o Node.py the node class implementation
o LikedList.py - the linked list class implementation
o Employee.py - the employee class implementation
o main.py - your main script
>>> main()
*** CS 172 Payroll Simulator ***
a. Add New Employee
b. Calculate Weekly Wages
c. Display Payroll
d. Update Employee Hourly Rate
e. Remove Employee from Payroll
f. Exit the program
Enter your choice: a
Enter the new employee ID: 123
Enter the hourly rate: 7.75
*** CS 172 Payroll Simulator ***
a. Add New Employee
b. Calculate Weekly Wages
c. Display Payroll
d. Update Employee Hourly Rate
e. Remove Employee from Payroll
f. Exit the program
Enter your choice: a
Enter the new employee ID: 234
Enter the hourly rate: 13.50
*** CS 172 Payroll Simulator ***
a. Add New Employee
b. Calculate Weekly Wages
c. Display Payroll
d. Update Employee Hourly Rate
e. Remove Employee from Payroll
f. Exit the program
Enter your choice: c
*** Payroll ***
Employee ID: 123
Hourly Rate: 7.75
Hours Worked: 0.0
Gross Wages: 0.0
Employee ID: 234
Hourly Rate: 13.5
Hours Worked: 0.0
Gross Wages: 0.0
*** CS 172 Payroll Simulator ***
a. Add New Employee
b. Calculate Weekly Wages
c. Display Payroll
d. Update Employee Hourly Rate
e. Remove Employee from Payroll
f. Exit the program
Enter your choice: b
Enter hours worked for employee 123 : 15
Enter hours worked for employee 234 : 11.50
*** CS 172 Payroll Simulator ***
a. Add New Employee
b. Calculate Weekly Wages
c. Display Payroll
d. Update Employee Hourly Rate
e. Remove Employee from Payroll
f. Exit the program
Enter your choice: c
*** Payroll ***
Employee ID: 123
Hourly Rate: 7.75
Hours Worked: 15.0
Gross Wages: 116.25
Employee ID: 234
Hourly Rate: 13.5
Hours Worked: 11.5
Gross Wages: 155.25
*** CS 172 Payroll Simulator ***
a. Add New Employee
b. Calculate Weekly Wages
c. Display Payroll
d. Update Employee Hourly Rate
e. Remove Employee from Payroll
f. Exit the program
Enter your choice: e
Enter the ID of the employee to remove from payroll: 123
Done.
*** CS 172 Payroll Simulator ***
a. Add New Employee
b. Calculate Weekly Wages
c. Display Payroll
d. Update Employee Hourly Rate
e. Remove Employee from Payroll
f. Exit the program
Enter your choice: f
Good-Bye!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
