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
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