A Java Program

เสร็จสมบูรณ์ โพสต์แล้ว Jan 30, 2012 ชำระเงินเมื่อจัดส่ง
เสร็จสมบูรณ์ ชำระเงินเมื่อจัดส่ง

A parking garage consists of a single lane which can hold up to 7 cars.

Cars arrive at the south end of the garage, and leave from the north

end. If an owner arrives to pick up the car that is not the northernmost,

then all cars to its north are moved out, owner's car is driven out,

and the other cars are restored in the same order that they were in

originally. If there is no room for an arriving car in the garage, then

it waits in a Waiting Line. A car waits in the waiting line until there is

room in the garage or the car departs from the waiting line itself. Cars

move from the waiting line into the garage on a first-come-first-served basis.

In this assignment, you are required to simulate the operation of such

a parking garage. Simulation means that your program should go through

all the steps that will be carried out in the actual garage without omission.

Write a Java program that reads a sequence of input lines from an input

file (prompt the user to specify the name of the input file), each input

line containing an "A" for arrival and a "D" for departure, along with the

license plate number of the car. Cars are assumed to arrive and depart in

the order specified by the input. For each car, you must keep a count of

how many times it was moved out of the garage. So, when a car A moves out

of the garage to allow another car B behind it to move out, that counts as

a move out of the garage for that car A, also. Departure from the waiting

list is not counted as a move out of the garage.

You must use a linked implementation of the list for the waiting list,

a double-ended-queue for the garage (in fact, this is an output-restricted

deque), and an array implementation of stack (I know you will need this).

An additional operation allowed on this deque is "find" that returns a

boolean value depending on whether the car is in the garage or not.

You are perfectly free to pick up codes for these data structures from the

text but no where else. Even if you use the code from the book, make sure

that you understand its implementation perfectly well. Spending time in

designing a good solution will help you tremendously.

For every operation, arrival or departure, you must output the operation

performed on the garage, which car was involved, and the state of the

garage and the waiting line (if not empty) after that arrival or

departure. For departing cars, in addition to the above information,

output the number of times that car was moved out of the garage.

Java

หมายเลขโปรเจค: #1417511

เกี่ยวกับโปรเจกต์

2 ข้อเสนอ โปรเจกต์ระยะไกล ใช้งาน %project.latestActivity_relativeTime|แทนที่%

มอบให้กับ:

barundebnath

Easy job. Can be done within few hours.

$30 USD ใน 1 วัน
(34 รีวิว)
5.2

freelancer 2 คน กำลังเสนอราคาในงานนี้ โดยมีราคาเฉลี่ยอยู่ที่ $35

sidvedere

Hello.., I could handle your program. Please get back to me with further details and implementation instructions

$40 USD ใน 4 วัน
(0 รีวิว)
0.0