Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Need help! expert or noob also can!

Hi!

I'm new to here. i'm not sure whether a thread like this is allowed in here or not, if cannot, please delete this thread. Anyway, i really need u guys help, quite urgent as well.

I'm just new to java programming, i'm facing a lot of problem with it. Hope u guys can help out me with a simple java coding, just a simple coding using notepad also never mind, i just want to have a example for it. Thank you for helping me!!! The question i'll put it at down.

Question:

In this assignment, you have to come up with a program that can simulate a car-parking garage that can handle 10 cars. The garage is long enough to accommodate 10 cars but is very narrow such that its' width can accommodate 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 similar in size where only one of the garage is used as the parking area. The other garage is used as a 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 one the intended car is taken out.

Input file:

A, ABC1234
A, ABC6789
-
-
D, ABC6789
A, ZXC2345
-
A, QWE3456
-
D, ZXC2345
-
-
X

Each line of input represent 1 minute of time. The input file will consists of 60 lines and will be terminated by am marker X.

Output:

For every single minute, print the steps of action taken by the program in order to process the arrival or departure of a car, if any.

For every 10 minutes, print the contest of the main garage.
[1770 byte] By [ching4ever] at [2007-11-11 7:32:17]
# 1 Re: Need help! expert or noob also can!
So - what have you started with? What kind of data structure does the call of the question bring to your mind? Can you sketch out in words how you can approach this problem?
nspils at 2007-11-11 22:38:02 >
# 2 Re: Need help! expert or noob also can!
in my mind, i think using stack and queue will be enough for this question. is it possible and correct?
ching4ever at 2007-11-11 22:39:02 >
# 3 Re: Need help! expert or noob also can!
It sounds like two stacks to me ... I read the call of the question as requiring the two garages to be the same structure, both in size/width and loading/unloading mechanism.

So, now you need to design your approach for the following processes:

1. reading the input from the file
2. loading the main garage
3. designing the process for removing the identified car
4. outputting the steps which are taken to remove the identified car
5. every 10 minutes, printing out the structure of the main garage
nspils at 2007-11-11 22:40:01 >
# 4 Re: Need help! expert or noob also can!
is there any example or sample coding about the same like this question? i need some to refer, i'm too lousy in programming...

thanks a lot for the steps! :)
ching4ever at 2007-11-11 22:41:00 >