Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A parking garage charges a $2.00 minimum fee to park for up to three hours. The

ID: 670464 • Letter: A

Question

A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour of part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours.

Write a program that calculates and displays the parking charges for each customer who parked in the garage and displays the running total of the day’s receipts.

Specification

Create a ParkingCharges ClassCreate a member function double parkingCharges(double hours).

Accepts the hours parked as an argument.

Calculates the parking charge based on the hours.

Returns the parking charge.

Add other data members and member functions as appropriate.

Separate the class into both interface (.h) and implementation (.cpp) files.

Write an application the uses the ParkingCharges class and does the following:

Enter the hours parked.

Calculate and display the charges for this customer.

Add charges to the running total and display the running total.

Continue as long as there is another customer.

//ParkingCharges implementation

#include "parkingcharges.h"
#include
#include


using namespace std;

double charge;
double hours, hour1,hour2,hour3;
double totalHours;

ParkingCharges::ParkingCharges()
{


}

double ParkingCharges::getCharge()
{
double hours = charge;


if(hours == 24)
{
charge = 10.0;
}

else if(hours < 3)
{
charge = minCharge + surCharge;

}
else
charge = minCharge;

return charge;
}

double ParkingCharges::getHours()
{
return totalHours;

}

/* Mutator Functions */

void ParkingCharges::setCharge(double)
{
double minCharge = 2.0;
double surCharge = 0.5;
double maxCharge = 10.0;
}

void ParkingCharges::setHours(double)
{
hours = hour1 + hour2 + hour3;
totalHours = hours;
}

//Parking Charges header file

#ifndef PARKINGCHARGES_H
#define PARKINGCHARGES_H

class ParkingCharges
{
public:
ParkingCharges();

/* Accessor Functions */
double getCharge();
double getHours();

/* Mutator Functions */
void setCharge(double);
void setHours(double);

private:

double minCharge = 2.0;
double surCharge = 0.5;
double maxCharge = 10.0;
int maxHours = 24;

};

#endif // PARKINGCHARGES_H

// main.cpp

#include
#include
#include "parkingcharges.h"


using namespace std;

int main()
{
double hours;
while(hours != -1)
{


ParkingCharges pc;


cout << " Welcome to the Parking Garage Calculator" << endl
<< "1) Number of Customers Entered: " << endl
<< "2) Total Hours Entered: " << pc.getHours() << endl
<< "3) Total Receipt: " << pc.getCharge() << endl
<< "Enter your Hours (or -1 to quit): " << endl;
cin >> hours;
cout << endl;
system("PAUSE");

}

return 0;
}

I'm having problems setting up my getter and setter function in my implementation section and need some advice as to what I should do to properly set them up.

/* Output */

Welcome to the Parking Garage Calculator

1) Number of Customers Entered:

2) Total Hours Entered: 0

3) Total Receipt: 2.5

Enter Your Hours (or -1 to quit):

Explanation / Answer

#include #include #include using namespace std; double calculateCharges (double hours) { double result; if (hours = 11) result = 10.00; else result = 2.00 + ceil((hours - 3)) * 0.50; return result; } int main() { double totalCharge = 0; double totalHours = 0; double charge; double hoursFirst, hoursSecond, hoursThird; cout > hoursSecond >> hoursThird; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote