Question: In python Notes: Use the same documentation and design rules as stated in previous assignments. This problem studies use of functions, exceptions and reading data

In python
Notes:
Use the same documentation and design rules as stated in previous assignments.
This problem studies use of functions, exceptions and reading data from an input file to produce a payroll report. Input text file payroll.txt contains an unknown number of data sets. Each data set lists an employee identification number, name, integer number of dependents, integer hours worked and hourly pay rate with one entry per line. Text file payroll2.txt contains another sample.
Ask the user for the name of the input text file using a try / except statement. If the file cannot be found, the except suite should report an error message and end the program.
Read, process, and display each line of data. The code should be able to handle any number of data sets so it works for any input file. Assume the file contains at least one data set. Assume data is valid. This code should use a while loop.
Product a report similar to the one below with respect to layout. Regular pay uses the hourly rate up to 40 hours. Overtime pay is pay for hours over 40 at 1.5 times the hourly rate. Gross pay is the sum of regular pay and overtime pay. Federal tax is 0.22**(gross pay - dependents*24.32). State tax is 4% of gross pay. Net pay is gross pay minus taxes. The report should make columns with f strings and use 2 decimals on monetary amounts. Display the number of employees awarded overtime and the sum of overtime pay at the bottom of the report.
Code Specifications:
This assignment requires user defined functions described below.
No global variables are accepted.
A while loop should be used to read the data sets from the file. Do not use a for loop variant. Infinite while True: loops with any jump statements such as break or continue are not accepted.
Include the following functions. Do not change the function headings or purpose. Include the function comment.
Include the main function at the top of the code def main ():
This function is passed the hours and the rate and returns the regular pay based on hourly rate def regular_pay (hours, rate): # return amount of regular pay
This function is passed the hours and the rate and returns the overtime pay based on overtime rate def overtime pay (hours, rate): # return amount of overtime pay
This function is passed the gross pay and the number of dependents and returns the federal tax. def federal_tax (gross, dependents): # return amount of federal tax
This function is passed the gross pay and and returns the state tax. def state_tax (gross): # return amount of state tax
In python Notes: Use the same documentation and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!