Answer:
hope this helps!
Step-by-step explanation:
#include <stdio.h>
// Function to calculate charges
float calculateCharges(float hours) {
float minFee = 20.00;
float charge;
if (hours <= 3.0) {
charge = minFee;
} else if (hours > 3.0 && hours < 8.0) {
charge = (hours - 3) * 5 + minFee;
} else {
charge = 50.00;
}
return charge;
}
int main() {
float chargeOne, chargeTwo, chargeThree, hoursOne, hoursTwo, hoursThree, totalHours, totalCharge;
printf("Enter the number of hours for the first customer: ");
scanf("%f", &hoursOne);
chargeOne = calculateCharges(hoursOne);
printf("Enter the number of hours for the second customer: ");
scanf("%f", &hoursTwo);
chargeTwo = calculateCharges(hoursTwo);
printf("Enter the number of hours for the third customer: ");
scanf("%f", &hoursThree);
chargeThree = calculateCharges(hoursThree);
printf("\\Car\tHours\tCharge\\");
printf("1\t%.1f\t$%.2f\\", hoursOne, chargeOne);
printf("2\t%.1f\t$%.2f\\", hoursTwo, chargeTwo);
printf("3\t%.1f\t$%.2f\\", hoursThree, chargeThree);
totalHours = hoursOne + hoursTwo + hoursThree;
totalCharge = chargeOne + chargeTwo + chargeThree;
printf("\\Total\t%.1f\t$%.2f\\", totalHours, totalCharge);
return 0;
}