Menu

Write C Program Compute Worker S Pay Based Rate Per Hour Number Hours Worked Program Must Q43888079

Write a C program to compute a worker’s pay, based on arate per hour and number of hours worked.

– The program must include a single function namedcalculatePay, which does the computations. The function shouldaccept 2 parameters: a rate per hour, and the number of hoursworked – both of which can be fractional. The function should NOTprint anything (you can use print statements for testing if youwish, but those should be deleted or commented out before you turnin the assignment). The function should return the amount to bepaid.

Then the main program code should print each person’spay.

Additional details (for the calculation of thepay):

– Up to and including the first 40 hours, should be paidat the regular rate per hour.

– Any additional hours between forty and sixty, shouldbe paid at an overtime rate of one and a half times therate.

– If the person works more than 60 hours, in additionalto all of the above, those hours should be paid at double the rateper hour.

To show that the function works correctly, the mainprogram MUST include three calls the function with the followingthree sets of data. Verify that you get the givenresults.

1) Rate of 30, 20 hours. Should calculate a total pay of600

2) Rate of 15.50, 50 hours. Should calculate 40 hours atregular rate plus 10 hours at time and a half, should calculate atotal pay of 852.5

3) Rate of 11, 70.25 hours. Should calculate 10.25 hoursof double time pay, plus 20 hours of time and a half plus 40 hoursof regular pay for a total of 995.5

Please write this in programming C language and please explainwhat we are doing in each step.

Expert Answer


Answer to Write a C program to compute a worker’s pay, based on a rate per hour and number of hours worked. – The program must i…

OR