Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C + + program The Putdentsinem Parking Garage contains a single lane that holds up to 1 0 cars. Cars arrive at the

Write a C++ program The Putdentsinem Parking Garage contains a single lane that
holds up to 10 cars. Cars arrive at the south end of the
garage and leave from the north end. If a customer arrives to
pick up a car that is not the northenmost, all cars to the north
of his car are moved out , his car is driven out , and the
other cars are restored in the same order that they were in
originally. Whenever a car leaves , all cars to the south are
moved forward so that at all times all the empty spaces are in
the south part of the garage.
Write a program that reads a group of input lines. Each line
contains an 'a' for arrival or a 'd' for departure and a license
plate number. You should TRY to use strings as license plate numbers but if you have difficulty use integers!
Cars are assumed to arrive and depart in the order
specified by the input. The program should print a message each
time that a car arrives or departs. When a car arrives , the
message should specify whether or not there is room in the
garage for the car. If there is no room for a car , the car
then proceeds to the Knockemdead garage...which is similar to the
Putdentsinem. There is room for 10 cars at the Knockemdead garage.
Now...if both garages are filled up, cars wait in the street
near the Putdentsinem garage for a space..and of course they are queued
up in the street. The size of the street queue is also 10. I will
not allow more than 30 cars total so don't worry about overflow
on the street!
So in summary...when a car arrives it tries to park in the Putdentsinem garage.
If no room it goes to the Knockemdead...a message indicates which garage
it is in.....When a car departs a message indicates that a car has departed
and also indicates which garage...
Now here is the challenge...when a car departs you should also
indicate what the parking fee is...here is how it works
If a car is at the front of the queue, the charge is $ 2.00
If a car is second in the queue (that is you need to move one
car out of the way) the charge is $ 4.00
If a car is third in the queue the charge is $ 6.00
get the idea??? Note: If a car departs from the street there is
of course no charge. Also if both garages are full and a car
departs from either garage, the car in front of the street queue moves
into the garage! BE SURE A MESSAGE INDICATES THIS

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

Question Can a Roth IRA invest in stock of the IRA owners business?

Answered: 1 week ago