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

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...
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
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.
Vora Fund charges a 12b-1 fee of 1% and maintains an expense ratio of 0.65%. Vora...
Vora Fund charges a 12b-1 fee of 1% and maintains an expense ratio of 0.65%. Vora fund charges a front-end load of 2%, but has no 12b-1 fee and an expense ratio of 0.35%. Assume the rate of return on both funds’ portfolios (before any fees) is 6% per year. a. How much will an investment of $100 in each fund grow to after 1 year? (Do not round intermediate calculations. Round your answers to 2 decimal places.) Loaded-Up Fund...
James is considering an investment in a no-load mutual fund; the fund charges a 12b-1 fee...
James is considering an investment in a no-load mutual fund; the fund charges a 12b-1 fee of 0.5% per year as well as an operating expense ratio of 1% per year. Alternatively, he can invest instead in a bank saving account paying 7% interest. If he plans to invest for five years, and the mutual fund promise that the fund portfolio will earn 8% per year in the first three years, then what annual rate of return must the fund...
Loaded-up Fund charges a 12b-1 fee of 1% and maintains an expense ratio of 0.90%. Economy...
Loaded-up Fund charges a 12b-1 fee of 1% and maintains an expense ratio of 0.90%. Economy Fund charges a front-end load of 2%, but has no 12b-1 fee and an expense ratio of 0.10%. Assume the ratio of return on both funds' portfolios (before any fees) is 5% per year. How much will an investment of $100 in each fund grow after 1 year? How much will an investment of $100 in each fund grow after 2 years? loaded-up fund...
Loaded-Up Fund charges a 12b-1 fee of 1% and maintains an expense ratio of 0.70%. Economy...
Loaded-Up Fund charges a 12b-1 fee of 1% and maintains an expense ratio of 0.70%. Economy Fund charges a front-end load of 2%, but has no 12b-1 fee and an expense ratio of 0.30%. Assume the rate of return on both funds’ portfolios (before any fees) is 7% per year. a. How much will an investment of $100 in each fund grow to after 1 year? (Do not round intermediate calculations. Round your answers to 2 decimal places.) Loaded-Up Fund...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT