Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

A parking garage charges a minimum fee of $2.00 to park for up to 3 hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of 3 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 will calculate and print the parking charges for each of 3 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 Hours Charge

1 1.5 2.00

2 4.0 2.50

3 24.0 10.00

Total 29.5 14.50

This is what I have so far please help because it will not work thanks

#include
#include
#include
#include

using namespace std;

const int CARS = 3;
static int hours[CARS] = {0, 0, 0,};

void enterHoursParked()
{
for(int i=0;i{
cout << "Enter the hours parked for each car"<< i;
cin >> hours[i];
}

}

float calculateCharges(int ilen)
{
float finalCharge;

if (ilen <= 3)
finalCharge = 2;
if (ilen >= 19)
finalCharge = 10;
if (ilen > 3)
finalCharge = 2 + (float)(ilen - 3) * .50;

return finalCharge;
}
void printCharges(int carno, int hours, float finalCharge)
{
if(carno == 0)
cout << "Car Hours Chargen";
else
cout << (carno)<<" "<< hours<<" "<< finalCharge<<"n";

}

int main()
{

cout << "Welcome!" << endl;
enterHoursParked();

for (int i = 0; i <= CARS; i++)
{
float finalCharge = calculateCharges(hours[i]);
printCharges(i,hours[i],finalCharge );

}

int l;
cin>>l;

return 0;
}

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9207098

Have any Question?


Related Questions in Computer Engineering

A chemistry student needsnbsp550 gnbspof dimethyl sulfoxide

A chemistry student needs 55.0 g of dimethyl sulfoxide for an experiment. By consulting the  CRC Handbook of Chemistry and Physics , the student discovers that the density of dimethyl sulfoxide is 1.10 g.cm^-3. Calculate ...

Answer the following question what is a remote procedure

Answer the following Question : What is a 'Remote Procedure Call (RPC)'? How a RPC is originated and what are the applications/examples of a RPC process? The response must be typed, single spaced, must be in times new ro ...

Question suppose a data packet datagram is sent in the

Question : Suppose a data packet (datagram) is sent in the Internet from a source station (computer) to a destination station. What type of addess (physical, MAC, port address or some other) is used to forward the datagr ...

Question please choose one of the following

Question: Please choose one of the following topics: • Internet of things (IOT) • Drones • Virtual Reality • Bitcoin • Encryption What is the current cybersecurity-related situation involving the topic you chose? What do ...

Question suppose that we have a computer that can test 240

Question : Suppose that we have a computer that can test 2 40 keys each second. What is the expected time (in years) to find a key by exhaustive search if the keyspace is of size 288? What is the expected time (in years) ...

Strategies when resources are constraineda project manager

Strategies When Resources Are Constrained A project manager has fewer options for accelerating project completion when additional resources are either not available or the budget is severely constrained. This is especial ...

How do you make a java program that reads two diagonal

How do you make a Java program that reads two diagonal points, say p1 and p2, of an up-right rectangle and finds both the smallest circle containing the rectangle and the largest circle that can be contained in the recta ...

Please explain to me the concept of policing with emphasis

Please explain to me the concept of policing with emphasis on the "leaky bucket" mechanism.

In a competitive market the market demand is qd 60- 6p and

In a competitive market, the market demand is Qd= 60- 6P and the market supply is the Qs= 4P the full economic price under a price ceiling of $3 is:?

Discuss the criteria necessary to establish a factor as a

Discuss the criteria necessary to establish a factor as a confounder and provide an example applying these criteria?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As