Originally Posted by
madhusanka
The laughs parking garage contains a single lane that hold up to ten 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 northernmost, all the cars to the north of his car are moved out, his car is driven out, and the others cars are restored in the same order that they were in originally. Whenever a car leaves, all the cars to the south are moved forward. So that at all the times all the empty spaces are in the south part of the garage.
Write a Java program to reads a group of input lines. Each line contains an “a” arrival or a “d” 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 massage should specify whether or not there is room for the car in garage. If there is no room for a car, the car waits until there is room or until a departure line is read for the car. When room becomes available, another massage should be printed. When a car departs, the massage should include the number of times the car was moved within the garage (including the departure itself but not the arrival), this number is 0 if the car departs from the waiting line.
Note:
Your documentation should include pseudo code, source code, test data and expected outputs for garage activities.
This question was supplied by University of Colombo for there Master of Information Technology students as a assignment therefor they should be try this by themselves. its ok to get help from the internet but ask for the full code is trying to cheat the university. therefore I kindly request from others not to supply any full code, because one day after getting their Masters and they will attend to some universities or any higher Educational Institute as a Lecturer then how they teach for their students. what will happened to the our youngsters.