Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implementation Create a python program that demonstrates reading and comparing multiple files, processes the input files based on the business rules, and produces an output
Implementation
Create a python program that demonstrates reading and comparing multiple files, processes the input files based on the business rules, and produces an output file.
Needed Files
The timeclock.txt Download timeclock.txtfile contains the hours worked data for every employee as well as the shift they worked. The layout for the file is as follows:
EMPLOYEENUMBER, HOURSWORKED, SHIFT
The personnel.txt Download personnel.txtfile contains the names of all employees and their hourly pay rates. The layout for the file is as follows:
EMPLOYEENUMBER, EMPLOYEENAME, PAYRATE
Note: Both the timeclock.txt and payroll.txt files are presorted by EMPLOYEENUMBER in ascending order.
Business Rules
For hours the employee gross pay is: HOURSWORKED PAYRATE
For hours the employee gross pay is: HOURSWORKED PAYRATE
For shift add $ per hour to the employee pay rate
The program should:
Download both input files in the same folder that you will create your py program.
Read both input files together.
Match the input files by the EMPLOYEE NUMBER.
For each record in the timesheet.txt file, write a record in a new output file named payroll.txt based on the business rules provided. The layout for payroll.txt is as follows:
EMPLOYEENUMBER, EMPLOYEENAME, GROSSPAY
Document your program with appropriate comments. Remember if you worked in teams, all team members' names must be in the comments.
Test your program by comparing your results to this expectedpayroll.txt Download expectedpayroll.txtfile. In general, running one test is not enough. Create at least two additional test runs by altering the timeclock.txt file. After EACH test run, rename the payroll.txt file to payrolltxt payrolltxt etc.
In the Word document that you created above, answer the question: My program runs as expected and why? Note: performing step above informs this answer.
Save your file as payrollyourlastname.py
Tip: Loop through the timeclock.txt file and compare it to records in the personnel.txt file on EMPLOYEENUMBER. Compute the employee gross pay and write the employee number, employee name, and the computer gross pay to the output file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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