Question

In: Computer Science

Use CPP 1) Parking charge application: A parking garage charges a $20.00 minimum fee to park...

Use CPP

1) Parking charge application: A parking garage charges a $20.00 minimum fee to park for up to 3 hours. The garage charges an additional $5.00 per hour for hour or part thereof in excess of 3 hours. The maximum charge for any given 24-hour period is $50.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charge 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 save the result in a array of Customer. The class customer is the following:

class customer{ string plate; float hour; float fee; }

Your program should use the function calculateCharges to determine the fee for each customer. You should print the result for the 3 customers in the following format:

Plate Hours Charge

132AAC 1.5 20.00

236URT 4.0 25.00

390ROP 24.0 50.00

TOTAL 29.5 95.00

In doing this question make sure to keep the array of customer as global variable.

Please send me the screenshot of output too.

Thanks

Solutions

Expert Solution

Program Parking charge application.

This program program use the function calculateCharges to determine the fee for each customer.

#include <iostream>

using namespace std;

int a[3];

// create a class customer

class customer

{

string plate;

float hour;

float fee;

int charges;

public:

void display()

{

int i,ch,sum=0;

for(i=0;i<=2;i++)

{

cout<<"Enter Plate";

cin>>plate;

cout<<"Enter hour";

cin>>hour;

cout<<plate<<"\t";

cout<<hour<<"\t";

// Invoking function calculateCharges

ch=calculateCharges(hour);

cout<<ch<<endl;

a[i]=ch;

sum=sum+ch;

}

cout<<sum;

}

// definition of function calculateCharges

int calculateCharges(float h)

{

if(h<=3)

charges=20;

else

charges=20+(h-3)*5;

if(charges>50)

charges=50;

return charges;

}

};

// main program

int main() {

customer obj; // object creation for class customer

obj.display();

}


Related Solutions

use c++ Parking charge application: A parking garage charges a $20.00 minimum fee to park for...
use c++ Parking charge application: A parking garage charges a $20.00 minimum fee to park for up to 3 hours. The garage charges an additional $5.00 per hour for hour or part thereof in excess of 3 hours. The maximum charge for any given 24-hour period is $50.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charge for each of 3 customers who parked their cars...
A parking garage charges R7.50 minimum fee to park for up to three and half hours....
A parking garage charges R7.50 minimum fee to park for up to three and half hours. The garage charges an additional R1.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24- hour period is R25.72. Write a program that calculates and prints the parking charges for each of three customers who parked their cars in this garage at some time. You should enter the hours parked for each customer....
Write a Java Program.A parking garage charges a $3.00 minimum fee to park for up to...
Write a Java Program.A parking garage charges a $3.00 minimum fee to park for up to three hours. The garage charges an additional $0.75 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $12.00 per day. Write an application that calculates and displays the parking charges for all customers who parked in the garage yesterday. You should enter the hours parked for each customer. The program should...
C program and pseudocode for this problem. A parking garage charges a $2.00 minimum fee to...
C program and pseudocode for this problem. A parking garage charges a $2.00 minimum fee to park for up to three hours and additional $0.50 per hour over 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 will calculate and print the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter...
using java and use stack library java Bashemin Parking garage The Bashemin Parking Garage contains a...
using java and use stack library java Bashemin Parking garage The Bashemin Parking Garage contains a single lane that holds up to ten cars. There is only a single entrance/exit to the garage at one end of the lane. If a customer arrives to pick up a car that is not nearest the exit, all cars blocking its path. are moved out, the customer's car is driven out and the other cars are restored in the same order that they...
3. Which of the following is NOT a mutual fund charge/fee A. 12b-1 charges B. Front-End...
3. Which of the following is NOT a mutual fund charge/fee A. 12b-1 charges B. Front-End load C. Back-End load D. Prepayment fee 5. Brian Griffin selects stocks for his portfolios by actively searching for undervalued stocks and then buying them. He doesn't try to spread his portfolio across asset classes, sectors or industries. The strategy that Brian is following is called A. Bear Spread B. Bull Spread C. Top-down D. Bottom-up
Which of the following is NOT a mutual fund charge/fee A. 12b-1 charges B. Front-End load...
Which of the following is NOT a mutual fund charge/fee A. 12b-1 charges B. Front-End load C. Back-End load D. Prepayment fee
A no-load fund charges a 12b-1 fee of 1% and maintains an expense ratio of 0.75%....
A no-load fund charges a 12b-1 fee of 1% and maintains an expense ratio of 0.75%. Assume the securities in which the fund invests increase in value by 6% per year. How much will an investment of $1000 grow to after 5 years?
a no-load fund charges a 112b-1 fee of 1% and maintains an expense ratio of 0.75%....
a no-load fund charges a 112b-1 fee of 1% and maintains an expense ratio of 0.75%. Assumes the securities in which the fund invests an increase in value by 6% per year. How much will an investment of $1000 grow to after 5 years? a. $1,231.35 b. $1,263.72 c. $1,195.33 d.$1,300.53
Use Mortality Table to calculate the minimum premium an insurance company should charge for a $1...
Use Mortality Table to calculate the minimum premium an insurance company should charge for a $1 million two-year term life insurance policy issued to a woman aged 50. Assume that the premium is paid at the beginning of each year and that the interest rate is zero.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT