Question
The Scratchemup Parking Garage contains a single lane that holds up to six cars. Cars arrive at the south end of the garage and leave
The Scratchemup Parking Garage contains a single lane that holds up to six 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 northernmost, 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. 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 Bashemup garage...which is similar to the Scratchemup. There is room for 6 cars at the Bashemup Garage. Now...if both garages are filled up, cars wait in the street near the Scratchemup garage for a space..and of course they are queued up in the street as well. The street can hold only six cars. If more than 6 cars try to wait in the street the cars are told to go to New Jersey. So in summary...when a car arrives it tries to park in the Scratchemup If no room it goes to the Bashemup...If still no room it tries to park in the street When a car departs a message should indicate where it departed from (i.e. which garage or the street) If there is a car waiting to get in the garage (because both are full) then the first car in the street queue must be moved into the garage that now has room and a message stating this must appear. When a car exits the garage (but NOT the street) the parking fee must be also be displayed as follows: Cars at front of queue : $ 5 Cars next in line: $ 8 Other cars : $12 The possibility also exists that the car you are looking for is not there!! Hey this is the BIG APPLE!
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