Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Speicatin(Fun calculates and returns the total weekly pay for an individual. Thi

ID: 3596024 • Letter: S

Question

Speicatin(Fun calculates and returns the total weekly pay for an individual. This worked by the person that week (let's 1. Define a C function named computePay that the total number of hours function has two input parameters, both double: call that h), and the base pay rate per hour (le t's call that r). The total pay for the week is calculated as follows: oursh is less than 0 or more than 100, that is clearly a data entry error, and the function should return a value of 0.0. The individual is paid the base hourly rate, r, for each of the first 40 h . The individual is paid 1.5 times the base rate for all hours above 40. ay

Explanation / Answer

#include <stdio.h>
double computePay(double h, double r) {
double total = 0;
if(h < 0 || h > 100) {
return total;
} else {

if(h > 40) {
total = (h - 40) * 1.5 * r;
h = 40;
}
total = total + (h * r);
return total;
}
}
int main()
{
double h,r;
printf("Enter the hours: ");
scanf("%lf", &h);
printf("Enter the rate: ");
scanf("%lf", &r);
printf("Pay: %lf ",computePay(h,r) );

return 0;
}

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote