K
kiamkhai
How to write a program that can simiulate a car-parking garage that can
handle unlimited number of cars. The garage is very narrow such that
its' width can accomodate only one car. There is only one entry point
to the garage at one of its end where the car can be parked or taken
out of the garage. Your car parking garage consists of two garages
where only one of the garage is used as the parking area. The other
garage is used as temporary area for the other cars that is blocking
the car that need to move out. The other cars moved to the temporary
garage will be stored back to the main garage once the intended car is
taken out.
Input file:
A,ABA1234
A,ABC6789
-
-
D,ABC6789
A,ZXC2345
-
A,QWE3456
-
D,ZXC2345
-
-
X
Each line of input represent 1 minute of time. The input file will
consist of 60 lines and will be terminated by an marker X.
handle unlimited number of cars. The garage is very narrow such that
its' width can accomodate only one car. There is only one entry point
to the garage at one of its end where the car can be parked or taken
out of the garage. Your car parking garage consists of two garages
where only one of the garage is used as the parking area. The other
garage is used as temporary area for the other cars that is blocking
the car that need to move out. The other cars moved to the temporary
garage will be stored back to the main garage once the intended car is
taken out.
Input file:
A,ABA1234
A,ABC6789
-
-
D,ABC6789
A,ZXC2345
-
A,QWE3456
-
D,ZXC2345
-
-
X
Each line of input represent 1 minute of time. The input file will
consist of 60 lines and will be terminated by an marker X.