Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Coding Question. Write a textual program to process time cards. It should let the user choose an input file holding the time card data

Python Coding Question.

Write a textual program 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

Clinton,Will,9.75,13.6 

This line means that Mr. Clinton gets $9.75/hour and 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,

Clinton,Will,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. Sample time cards and results files are attached so that you may check your program. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions