Computer Science
I need help writting a program in java
Write a program to simulate a train route. A train route consists of a number of
stations, starting and ending with a terminal station. The time that the train needs to
travel between a pair of consecutive stations on the route is given. Associated with
each station is a queue of passengers. Passengers are generated at random times,
assigned to entry stations randomly, and given random destination stations. Trains
leave a terminal at regular intervals and visit the stations on the route. When a train
stops at a station, all passengers for that station exit first. Then any passengers
waiting in the queue at the station board the train until either the queue is empty or the train is full.
Answers
Answered by
1
Answer:
Program to simulate the train route
Program Plan:
• Create interface for ADT queue that represent the methods to add new value, remove either single or all value from the list, find the front value of list.
• Create class to implement the ADT queue by defining the above interface methods.
• Create class that represents the train passenger information like boarding point, destination point and waiting time for train at the station.
• Create class that represents the station where passenger will wait for the train.
• Create class to represent the train. It define the no. of trains, capacity of train, train number etc.
• Create the main class that consist the main method to simulate the complete train route
Similar questions