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 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: getregularhours getregularpay getovertimehours and getovertimepay
The getregularhours 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 the regular hours should be Otherwise, the function should return all of the hours worked as regular hours.
The getregularpay function should have parameters for the number of hours worked and the regular rate. It should call the getregularhours 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 getovertimehours function should have a parameter for the number of hours worked. If the number of hours worked is less than or equal to the function should return If the hours worked provided is more than the overtime hours can be calculated by subtracing from the number of hours worked and returning the difference.
The getovertimepay function should have parameters for the number of hours worked and the hourly rate. The function should call the getovertimehours function to get the number of overtime hours and multiply that by the hourly rate and again by 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
