Question: This assignment will require you to build a program to calculate a paycheck. It will prompt the user for the number of hours worked and

This assignment will require you to build a program to calculate a paycheck. It will prompt the user for the number of hours worked and the hourly rate. The first 40 hours worked are considered regular pay and everything after that is considered overtime which is paid out at time and a half. The program should then use functions in the wages module to calculate paycheck details. It should print out the regular hours, over time hours, regular pay, overtime pay, and gross pay.
In the wages module, the following functions need to be built out: get_regular_hours(), get_regular_pay(), get_overtime_hours(), and get_overtime_pay().
The get_regular_hours() function should have a parameter for receiving the number of hours worked as an argument and it should return regular hours. Essentially, if the hours worked is greater than 40, the regular hours should be 40. Otherwise, the function should return all of the hours worked as regular hours.
The get_regular_pay() function should have parameters for the number of hours worked and the regular rate. It should call the get_regular_hours() function above to get the number of regular hours and then mutiply the number of reguar hours by the regular rate to return the regular pay amount.
The get_overtime_hours() function should have a parameter for the number of hours worked. If the number of hours worked is less than or equal to 40, the function should return 0. If the hours worked provided is more than 40, the overtime hours can be calculated by subtracing 40 from the number of hours worked and returning the difference.
The get_overtime_pay() function should have parameters for the number of hours worked and the hourly rate. The function should call the get_overtime_hours() function to get the number of overtime hours and multiply that by the hourly rate and again by 1.5. It should return the overtime pay amount.

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!