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: 3861866 • 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 or 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. The parking lot attendant should enter the hours parked for each customer. The application then calculates and displays the parking charges for that customer and calculates and display the running total of all receipts. Instructions Based on the problem statement, write an algorithm ( the sequence of actions required) to calculate the parking charges for each customer and to keep the running total of all receipts for a single business day. Save your algorithm in a PDF file. Create a UML Use Case Diagram based on the problem statement. Use UMLet and save the diagram in PDF format. Create a UML Activity Diagram based on the problem statement and your algorithm. Use UMLet and save the diagram in PDF format.

Explanation / Answer

#include <iostream>

#include <iomanip>

#include <math.h>

using namespace std;

float calculateCharges(float hours)

{

    float total_charge = 2.0;

if(hours > 3){

        total_charge += (ceil(hours) - 3) * 0.5;

    }

if(total_charge > 10.00){

        total_charge = 10.00;

    }

return total_charge;

}

void printReport(float car1, float car2, float car3)

{

    float car1_charges = calculateCharges(car1);

    float car2_charges = calculateCharges(car2);

    float car3_charges = calculateCharges(car3);

cout << fixed

         << setprecision(2)

         << setfill('0');

cout << "Car Hours Charge" << endl

         << "1 " << car1 << " $" << car1_charges << endl

         << "1 " << car2 << " $" << car2_charges << endl

         << "1 " << car3 << " $" << car3_charges << endl

         << "TOTAL " << car1 + car2 + car3 << " $"

         << car1_charges + car2_charges + car3_charges << endl;

}

int main()

{

    float car1, car2, car3;

cout << "PARKINGMETER.app" << endl

         << "------" << endl

         << "Car #1: ";

    cin >> car1;

    cout << "Car #2: ";

    cin >> car2;

    cout << "Car #3: ";

    cin >> car3;

printReport(car1, car2, car3);

return 0;

}

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