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

CODE IN C++ and include algorithm Project 3 – Parking Deck Ticketing System Obje

ID: 3913448 • Letter: C

Question

CODE IN C++ and include algorithm


Project 3 Parking Deck Ticketing System

Objectives:

Instructions:

Your task is to write a program that simulates a parking meter within the parking deck. The program will start by reading in the time a car arrives in the parking deck. Next it will read in the time the car left the parking deck. You should then calculate the time that has passed between issuing the time ticket and the time the car left. Lastly, you will use this information to determine how much the person needs to pay upon leaving the deck. The rates are in the table below. Please read through all of the notes below!

You should write a single function for each of the following things:

Notes:

Time should be handled in the 24 hour format for simplicity. In addition, you should have the user input the hours, then input the minutes as two separate variables. Please have the user enter hours ranging from 0 to 23, and minutes ranging from 0 to 59.

You may assume that the parking deck is open 24/7 for simplicity. You do not need to worry about times the deck closes for this project.

If the driver has a special parking pass, the program will read in the time of 99 for the hour and 99 for the minutes when entering the deck. This should be used as a code for the system to know that this person has a special parking pass.

If the drive has lost their ticket, the program will enter the inputof 55 for the hour and 55 for the minutes when exiting the deck. This will prompt the system to handle the payments without a ticketing stub.

Please make sure that the output is attractive and informative. It should include, but is not limited to: the time the ticket was issued the time the ticket was entered back into the machine (time the driver exited the deck.) You should also include the amount of time that transpired while the driver was in the deck and the amount of money the driver has to pay. Please use proper formatting techniques for output (fixed and set precision, remember we are talking about money.) Use the output format given below in Running.

Rate Table:

Time in Parking Deck

Rate in Dollars ($)

Less than or equal to 30 minutes

3.00

30 Minutes <= 1 Hour

5.00

1 Hour <= 2 Hours )

10.00

2 Hours <= 3 Hours )

15.00

3 Hours <= 4 Hours )

30.00

Each half hour over four hours and <= 12 hrs

30.00 + 5.00 per additional half hour or part thereof

12 Hours < 24 Hours )

Error prints out, see notes above.

Lost ticket

110.00

Special Parking Pass

5.00

Running:

Please run the following sets of data, using this format for the output:

Entrance Hour

Entrance Minute

ExitHour

Exit Minute

Total Minutes or Hours and Minutes

Price for Parking

Run 1

00

00

00

30

Run 2

05

45

07

00

Run 3

06

32

09

54

Run 4

09

15

12

15

Run 5

09

32

14

35

Run 6

08

00

10

30

Run 7

08

45

55

55

LOST TKT

Run 8

99

99

99

99

SPECIAL

Run 9

9

10

23

30

ERROR

Run 10 Extra Credit

17

0

4

0


Extra Credit (5 points):

What happens if you were to arrive at 5:00 PM and leave at 4:00 AM? Would your program still run this correctly? Make sure that you can account for this sort of issue. Add data to test this situation.

Time in Parking Deck

Rate in Dollars ($)

Less than or equal to 30 minutes

3.00

30 Minutes <= 1 Hour

5.00

1 Hour <= 2 Hours )

10.00

2 Hours <= 3 Hours )

15.00

3 Hours <= 4 Hours )

30.00

Each half hour over four hours and <= 12 hrs

30.00 + 5.00 per additional half hour or part thereof

12 Hours < 24 Hours )

Error prints out, see notes above.

Lost ticket

110.00

Special Parking Pass

5.00

Explanation / Answer

/* Purpose: This program is a Parking Deck Ticketing System. Punch in your arrival time

(hours then minutes) and your departure time (hours then minutes). If you lost

your parking ticket, input the values of 55; if you have a special parking pass,

select 99 for all values. Make sure you stay within the range. Enjoy!

*/

#include <iostream>

#include <iomanip>

using namespace std;

double H_out, H_in, M_out, M_in, Time_passed(0), cost(0);

void getTime (double & H_out, double & H_in, double & M_out, double & M_in)

{

cout<< "For Special Ticket Holders only, input 99 for arrival hour and arrival minute" << endl;

cout<< "If ticket has been misplaced, input 55 for departure hour and departure minute:" << endl;

cout<< "Input arrival time in hours in the 0 - 24 hour range" << endl;

cin>>H_in;

cout<< "Input arrival time in minutes in the 0 - 59 minute range" << endl;

cin>>M_in;

cout<< "Input departure time in hours in the 0 - 24 hour range" << endl;

cin>>H_out;

cout<< "Input departure time in hours in the 0 - 24 hour range" << endl;

cin>>M_in;

}

double timePassage()

{

if (H_out >= H_in)

Time_passed = (H_out + M_out/60) - (H_in + M_in/60);

else if (H_out < H_in)

Time_passed = (24-(H_in + M_in/60)) + (H_out + M_out/60);

return Time_passed;

}

double PriceCalculation()

{

if (H_out == 55 && M_out == 55)

cost = 110.00;

else if (H_out == 99 && M_out == 99)

cost = 5.00;

else if (Time_passed < 0.5)

cost = 3.00;

else if (Time_passed < 1)

cost = 5.00;

else if (Time_passed < 2)

cost = 10.00;

else if (Time_passed < 3)

cost = 15.00;

else if (Time_passed < 4)

cost = 30.00;

else if (Time_passed >= 4 && Time_passed < 12)

cost = 30.00 + (Time_passed - 4)*10;

else if (Time_passed >= 12)

cout << "Error" << endl;

else

{

cout << "There was an error, your value(s) were incorrect!" << endl;

cost = 0.00;

}

return cost;

}

void printoutReciept()

{

cout << "Your time of arrival is:" << setfill('0') << setw(2) << H_in << ":" << setfill ('0') << setw(2) << M_in << endl;

cout << "Your time of departure is:" << setfill('0') << setw(2) << H_out << ":" << setfill ('0') << setw(2) << M_out << endl;

cout << "Your amount of time parked is:" << Time_passed << "Hours" << endl;

cout << "Your bill is $" << fixed << setprecision(2) << cost << endl;

}

int main()

{

cout << "This is Paye Kialain's Parking Meter; Enjoy!" << endl;

getTime (H_out, H_in, M_out, M_in);

timePassage();

PriceCalculation();

printoutReciept();

cout << "coded by Paye W. Kialain" << endl;

system("PAUSE");

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