Project #15719 - use the queue

IN NEW YORK CITY………

home of the “winningest” sports franchise ever

 

The Knockemdead 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 Knockemdead.

 

There is room for 6 cars at the Bashemup Garage. Now...if both garages are filled up, cars wait in   the street near the Knockemdead 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 BOSTON.

 

        So in summary...when a car arrives it tries to park in the Knockemdead

        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 either garage (but NOT the street) the parking fee must be also be displayed as follows:

If the car is at the front of the queue, fee is $10, if second in the queue $15, if third or further back, $25.

 

           

             The possibility also exists that the car you are looking for is not there!!

            Hey this is the BIG APPLE!

 

            First try it with integers then try strings

 

When we exit the program it should indicate how many cars are in each garage and  the street and the total of the fees collected (based on which cars departed)

Subject Computer
Due By (Pacific Time) 11/04/2013 12:00 am
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy