Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 3 Parking Deck Ticketing System Objectives: Use if, switch, and loop statements to solve a problem. Use input and output statements to model a

Project 3 Parking Deck Ticketing System

Objectives:

Use if, switch, and loop statements to solve a problem.

Use input and output statements to model a real world application

Incorporate functions to divide the program into smaller segments

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. It will then ask you what 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:

Reading in the arrival times and departure times

Calculate the passage of time

Determine how much the player needs to pay

Print out the receipt for the user. Including their arrival and departure times, time in the deck and how much they owe.

Notes:

Time should be handled in the 24 hour format for simplicity. In addition, you should put the data on a file with the hours and the minutes as two separate variables separated by a space. Please have the hours ranging from 0 to 23, and minutes ranging from 0 to 59 with a blank in between hours and minutes. See the second table below for the data.

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

If the drive has a special parking pass, please enter 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, please input 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 drive 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 due to pay back. Please use proper formatting techniques for output (fixed and set precision, remember we are talking about money.)

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 <= 12 hours

30.00 + 5.00 per additional half hour

>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 from an input file:

Entrance Hour

Entrance Minute

Exit Hour

Exit Minute

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

Run 8

99

99

99

99

Submitting:

Please include this document at the front of your project folder. This should be followed by the algorithm for your program. Next please include your source code, followed by all of your output. Lastly, please include your academic honesty promise. Please put all of these documents in a zipped folder and submit to D2L.

Extra Credit:

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

More Information on Project 3

If the ticket is lost (code 99), charge the patron $110.00. If the patron has a parking pass (code 55), the charge is $5.00. If the ticket shows more than 12 hours in the parking deck, print ERROR in the column where the charge usually goes. If you do the extra credit (in at 17:00 hours (5PM)and out at 4:00 (4AM)), the charge will be $100.00 for 11 hours. Present the answers in a table with column headings of entry hours & min (could be 99), exit hours & min (could be 99 or 55), total minutes in the parking deck (leave blank for codes of 99 and 55), and total cost of parking.

Answers are: 3.00, 10.00, 30.00, 15.00, 45.00, 15.00, 110.00, 5.00, ERROR, and 100.00(extra credit).

This is what I have so far. I need help in C++

#include #include #include #include using namespace std; void arr_Dep (int *h_arr, int *m_arr, int *h_dep, int *m_dep) { cout << "Please Enter the Time Your Car Arrived in the Parking Deck" << endl; cout << endl; cout << "***Time should be entered based on a 24-hour clock***" << endl; cout << " (Hours should be entered from - 0 to 23 - and minutes should be entered from - 0 to 59 -)"<< endl; cout << "Hours> "; cin >> h_arr; cout << "Minutes> "; cin >> m_arr; cout << endl; cout << "Please Enter Time Your Car left the Parking Deck" < "; cin >> h_dep; cout << "Minutes> "; cin >> m_dep; } void park_Cal (int h_arr, int m_arr, int h_dep, int m_dep) { int total_time, arr_h, arr_m; arr_h = h_arr - h_dep; arr_m = m_arr - m_dep; total_time = (arr_h * 60) + arr_m; return; } double bill_amt(int total_time, int h_arr, int m_arr, int h_dep, int m_dep ) { double charge; if (total_time <=30) cout << "Please Deposit $3.00"; if (total_time > 30 && total_time <= 60) cout << "Please Deposit $5.00"; if (total_time > 60 && total_time <= 120) cout << "Please Deposit $10.00"; if (total_time > 120 && total_time <= 180) cout << "Please Deposit $15.00"; if (total_time > 180 && total_time <= 240) cout << "Please Deposit $30.00"; if (total_time > 240 && total_time <= 720) { charge = 30; int c = total_time - 240; charge += (c/30)*5; } if (total_time > 720 && total_time <= 1440) cout << "An Error Has Occurred, Please Go To Main Building To Resolve Issue"; return -1; if (h_arr == 55 && m_arr ==55) cout << "Please Deposit $110.00"; if (h_arr == 99 && m_arr ==99) cout << "You have a Special Pass, Please Deposit $5.00"; } void printrec (int h_arr, int m_arr, int h_dep, int m_dep, int total_time) { cout << "Your Arrival time was "<< h_arr << ":" << m_arr << endl; cout << endl; cout << "Your Departure time is "<< h_dep << ":" << m_dep << endl; cout << endl; } int main() { int h_arr, m_arr, h_dep, m_dep, total_time; arr_Dep(&h_arr, &m_arr, &h_dep, &m_dep); // call function to generate random numbers. park_Cal(h_arr, m_arr, h_dep, m_dep); cout << "****Printing your receipt**** "; bill_amt(total_time,h_arr, m_arr, h_dep, m_dep); printrec(h_arr, m_arr, h_dep, m_dep, total_time); cout << endl; return 0; }

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

When there was controversy, was it clear who had the final say?

Answered: 1 week ago