CSC 273 - Data Structures

Dr R. M. Siegfried

Assignment #4 - Bashemin Parking Garage

Due Friday, October 18, 2019

The Bashemin Parking Garage contains a single lane that holds up to ten cars. There is only a single entrance/exit to the garage at one end of the lane. If a customer arrives to pick up a car that is not nearest the exit, all cars blocking its path. are moved out, the customer's car is driven out and the other cars are restored in the same order that they were in originally.

Write a program that processes a group of input lines. Each input 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 whenever a car arrives or departs. When a car arrives, the message should specify whether or not there is room for the car in the garage. If there is no room the car leaves without entering the garage. When a car departs, the message should include the number of times that the car was moved out to allow other cars to depart.

You will submit a program listing (properly commented), your sample data (at least 20 lines of text) and the output.

[Back to the Assignments Page]