Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program: C++ A Madison Square Garden street parkingAttendant charges $8.00 minimum fee to park for up to 5hours. The Attendant charges an additional $2.25 per

Program: C++

A Madison Square Garden street parkingAttendant charges $8.00 minimum fee to park for up to 5hours. The Attendant charges an additional $2.25 per hour foreach hour in excess of five hours. In addition, an extra $10 ischarged if it's a commercial vehicle. The maximum charge forany 24-hour period, for any type of vehicle is $50.75 . Writea program that calculates and prints the parking charges foreach of three customers who parked their cars with the MadisonSquare Garden street parking Attendant. The program shoulduse the following functions:

getCustomerNameAndHoursParked(): avoid function that asks for the employee’s fullname and Number of HoursParked. Use pass-by-reference to send these twoitems to main().

isVehicleCommercial(): a value returningfunction that asks if vehicle is commercial andreturns true or false.

calcCharges(): avalue returning function that calculates and returns the charge foreach customer to main().

The main() function shoulddisplay the customer's full name, an indication of whether vehicleis commercial, hours and charge for eachcustomer to an output file(report.txt) .

Sample Output: (User input in red)

Enter Customer Name: SusanSmith

Enter HoursParked: 1.5

Is vehicle commercial (Y/N)? Y

Enter Customer Name: FranklinBall

Enter HoursParked: 4.0

Is vehicle commercial (Y/N)? N

Enter Customer Name: FrancisSmith

Enter Hours Parked: 8.0

Is vehicle commercial (Y/N)? N

OUTPUT FILE: report.txt -- The program should generateoutput program in the following formaat:

Customer Hours Charge Commercial

Susan Smith 1.5 18.00 Y

Franklin Ball 4.0 8.00 N

Francis Smith 8.0 14.75 N

Note:

  • Use a for loop to prompt the user for their full name andnumber of hours parked and if vehicle is commercial for each of thethree customers.
  • The variables for all charges and number of hours should be oftype double.
  • Function calculateCharges() shoulduse a nested if/else structure todetermine the customer charge.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

Learn the range of product and service variations

Answered: 1 week ago