Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program to compute a workers pay, based on a rate per hour and number of hours worked. - The program must include

Write a C program to compute a workers pay, based on a rate per hour and number of hours worked.

- The program must include a single function named calculatePay, which does the computations. The function should accept 2 parameters: a rate per hour, and the number of hours worked both of which can be fractional. The function should NOT print anything (you can use print statements for testing if you wish, but those should be deleted or commented out before you turn in the assignment). The function should return the amount to be paid.

Then the main program code should print each persons pay.

Additional details (for the calculation of the pay):

- Up to and including the first 40 hours, should be paid at the regular rate per hour.

- Any additional hours between forty and sixty, should be paid at an overtime rate of one and a half times the rate.

- If the person works more than 60 hours, in additional to all of the above, those hours should be paid at double the rate per hour.

To show that the function works correctly, the main program MUST include three calls the function with the following three sets of data. Verify that you get the given results.

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

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

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

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions

Question

5. How would you describe your typical day at work?

Answered: 1 week ago

Question

7. What qualities do you see as necessary for your line of work?

Answered: 1 week ago