Ask Question
12 October, 09:10

Write a code the estimates a worker's weekly salary. The worker gets paid $12/hour. However, if they work over time (greater than 40 hours), the worker gets paid time and a half for any of the hours over 40 (e. g. if they wor ked 45 hours a week, they would get paid for 47.5 hours). However, the company has a policy that the worker cannot work more than 60 hours. Therefore, in the case of working greater than 60 hours, their salary gets capped at 60 hours. Your program shoul d input the number of hours worked in a week and should output their weekly salary (in whatever format that clearly shows the result)

+3
Answers (1)
  1. 12 October, 12:25
    0
    The C program is commented in the explanation

    Explanation:

    I am going to write a C program.

    /*The number of hours worked is an input*/

    void weeklyPay (int hours) {

    float Pay;

    /*If he works 40 or less hours, he is paid $12 an hour*/

    if (hours < = 40)

    Pay = 12*hours;

    /*If it is between 40 and 60, he gets 12 an hour plus time and a half over 40*/

    if (hours > = 40 && hours < = 60)

    Pay = 12 * (hours + 1.5 * (hours-40));

    /*Else he gets paid what he would if he worked 60 hours*/

    else

    Pay = 12 * (60 + 1.5 * (60-40));

    /*Output*/

    printf ("Weekly pay: %.2f/n", Pay);

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a code the estimates a worker's weekly salary. The worker gets paid $12/hour. However, if they work over time (greater than 40 ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers