Question

In: Computer Science

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 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.

Solutions

Expert Solution

#include <bits/stdc++.h>

using std::cout;

class Customer{
public:
  std::string plate;
  float hour;
  float fee;

  float calculateCharges(){
    if (hour > 3.0)
      fee = 20.0 + (hour - 3) * 5.0;
    else fee = 20.0;

    if (fee > 50.0)
      fee = 50.0;
    else
      ;

  return fee;
  }
};

Customer c[3];
int main(){

  int totalHrs= 0;
  int totalFee =0;

  c[0].plate = "132AAC";
  c[0].hour =  1.5;

  c[1].plate = "236URT";
  c[1].hour =  4.0;

  c[2].plate = "390ROP";
  c[2].hour =  24.0;

  cout << "Plate" << "\t" << "Hours" << "\t" << "Charge" << std::endl;

  for(int i = 0; i < 3; i++){
    totalHrs += c[i].hour;
    totalFee += c[i].calculateCharges();
    cout << c[i].plate << "\t" << c[i].hour << "\t" << c[i].fee << std::endl;

  }

  cout << "Total" << "\t" << totalHrs << "\t" << totalFee << std::endl;

  return 0;
}

Related Solutions

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...
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
In the arrangement above, charge A is -46 nC, while charges B and C are each...
In the arrangement above, charge A is -46 nC, while charges B and C are each 67 nC.Each side of the triangle is 7.7 cms. Determine the magnitude of the electric field at the center of the triangle, in N/C. What is the direction of the electric field in the previous problem? Express your answer in degrees measured counterclockwise from the positive x-axis.
Two stationary positive point charges, charge 1 of magnitude 3.35 nC n C and charge 2...
Two stationary positive point charges, charge 1 of magnitude 3.35 nC n C and charge 2 of magnitude 1.75 nC n C , are separated by a distance of 52.0 cm c m . An electron is released from rest at the point midway between the two charges, and it moves along the line connecting the two charges. What is the speed vfinal v f i n a l of the electron when it is 10.0 cm c m from...
A bank offers 30-year, $195,000 mortgages at 5.0 percent and charges a $4,000 refundable loan application fee. The current disclosure law requires
A bank offers 30-year, $195,000 mortgages at 5.0 percent and charges a $4,000 refundable loan application fee. The current disclosure law requires that any fees that will be refunded if the applicant is rejected be included in calculating the APR.What is the APR that they are required to disclose? (Do not round intermediate calculations and round your final answers to 2 decimal places. (e.g., 32.16))Insecurity Bank and Trust (Refundable) _____% APR _____%
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT