Answered step by step
Verified Expert Solution
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 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 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 I will
not allow more than 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 inWhen 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 ishere is how it works
If a car is at the front of the queue, the charge is $
If a car is second in the queue that is you need to move one
car out of the way the charge is $
If a car is third in the queue the charge is $
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started