Question
Python programming using sequences: strings. lists and files Write a program, graphical or textual, to process time cards. It should let the user choose an
Python programming using sequences: strings. lists and files
Write a program, graphical or textual, to process time cards. It should let the user choose an input file holding the time card data to process and an output file to hold the results. It should also display the total hours worked, the average time worked per employee, and the total amount of pay for this period. The input (time card) file consists of one employee on each line. A line consists of "Last,First,HourlyRate,HoursWorked", for example:
Smith,John, 9.75, 13.6
This line means that I get $9.75/hour and I worked 13.6 hours. The output (results) file that your program generates should again consist of one employee per line with each line having employee name and pay. For example:
Smith, John, 132.60
as 13.6 hours at $9.75/hour translates to $132.60. The easiest way to accomplish this is to open() both the input and output files at the beginning. In your loop that reads lines from the input file, also write to the output file. So the body of the loop will pull out the name and numbers from the input line and then output a line to the results file. With this time card file, the total hours are 345 with an average of 49.3 per employee and the total pay is $20,575.85. Make sure that your amounts of money are always expressed in standard "dollars" format with two digits after the decimal point.
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