Question: Question about parking charges. I have the code but I do not what does it mean The garage charges an additional $0.50 per hour for

Question about parking charges. I have the code but I do not what does it mean "The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours." "part thereof' means that if the parking hours are 3.5123, we need to charge $2.50 or $2.25 Thanks.

Question about parking charges. I have the code but I do not

This is my code:

// LAB 1:

// Programmer:

// Editor(s) used:

// Compiler(s) used:

#include

using std::cout;

using std::cin;

using std::endl;

using std::fixed;

#include

using std::setprecision;

#include

using std::ceil;

#include

//function templates

double calculateCharges(double);

int main()

{

cout

cout

cout

cout

cout

cout

//variables

char buf[100];

double hours = 0;

//prompt user for input

cout

cin >> buf; hours = atof(buf);

cout

cout

system("pause");

}

double calculateCharges(double hours)

{

if (hours

return 2.00;

else

{

if (hours

return 2.00 + ((ceil(hours) - 3) * 0.5);

else

return 10.00;

}

}

5.12 Parking Charges) A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format and should calculate and print the total of yesterday's receipts. The program should use the function calculateCharges to determine the charge for each customer. Your outputs should appear in the following format: Car 1 Charge 2.00 2.50 10.00 14.50 Hours 4.0 24.0 29.5 TOTAL

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!