Question: How can I make a program in Python using files and exceptions to process payroll for all hourly paid employees? The program should allow me

How can I make a program in Python using files and exceptions to process payroll for all hourly paid employees? The program should allow me to enter each employee's ID, name, hours worked, and hourly pay rate. It should calculate gross pay with overtime hours (beyond 40 h) that are paid 50% more. The program should display total number of employees, total number of hours worked by all employees, and a total gross pay and save them at the end into a text file and make a backup file.

The program should contain the following functions: main(), get_employee_info(), calc_gross_pay(hours, rate), display_pay_statement(emp_id, emp_name, hours_horked, hourly_pay_rate, gross_pay), save_pay_statement_to_file(file_object, emp_id, emp_name, hours_worked, hourly_pay_rate, gross_pay), save_summary_to_file(file_object, number_of_employees, total_hours_worked, total_gross_pay).

Note: The get_employee_info() should return employee id, name, hours worked, and hourly pay rate.You may name the text file and backup file yourself in the main function.

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!