Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create code that will open a text file for storing the employee information. The file must be opened so that entered data is added to
- Create code that will open a text file for storing the employee information. The file must be opened so that entered data is added to the data already in the file.
- Modify the code that stores the data in list objects to now write the from date, to date, employee name, hours worked, pay rate, and income tax rate as a record in pipe-delimited format to the text file
- After the user terminates the data entry loop, call a new function that will:
- Get input from the user for the From Date for which the report should be run. If the user enters "All" then all records will be read and displayed. Validate that the from date entered is in the format mm/dd/yyyy.
- Write a loop to read the records from the text file. If the user entered "All" or the from date in the record matches what the user entered, store each data element in a variable, and for that employee calculate the income tax and net pay.
- Display the from date, to date, employee name, hours worked, hourly rate, gross pay, income tax rate, income taxes and net pay for the employee inside the loop.
- Increment the total number of employees, total hours, total tax, total net pay and store the values in a dictionary object inside the loop.
- Display the totals after the loop terminates.
- Ensure all functionality is working correctly and code is written efficiently. For purposes of this assignment, writing code efficiently is defined as:
- Using correct naming conventions for all variables and objects.
- Using correct naming conventions for functions and methods.
- Using built-in functions whenever possible.
- Using the fewest lines of code needed to return multiple values from functions.
- Using the fewest lines of code needed to complete the functionality defined.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres a Python code snippet that accomplishes the tasks you described python Function to open the text file in append mode def openemployeefile try fi...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started