Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Programming . [40 marks] A train timetable for a train travelling between Vancouver and Toronto is given below Arrival Departure Day Station Vancouver Kamloops

Java Programming

image text in transcribedimage text in transcribed

. [40 marks] A train timetable for a train travelling between Vancouver and Toronto is given below Arrival Departure Day Station Vancouver Kamloops Jasper Edmonton Saskatoon Winnipeg Sioux Lookout | 05:0205:42 Hornepayne 15:3516:10 Capreol Toronto 20:30 06:00 06:35 16:0017:30 23:00 23:59 08:0008:25 20:45 22:30 2 2 2 4 4 5 00:1800:48 09:30 Store the information from each row of the table in an object. Then, arrange the objects in an ArrayList structure. Your program should now take the following commands in a continuous loop: I. Show-shows the full table II. Delay -the arrival of the train is delayed by at station ; that is, add the delay to the corresponding station entry. For example, Delay Edmonton 30 implies that the train would arrive 30 minutes later than the expected time of arrival in Edmonton. The new entry would be "Edmonton 23:30 00:29 3". All stations following Edmonton will also update their arrival and departure by +30 minutes, and consequently the day of arrival and departure as well. The result of this Delay command is shown below Station Vancouver Kamloop:s Jasper Edmonton Saskatoon Winnipeg Sioux Lookout 05:32 06:12 Hornepayne 16:0516:40 Capreol Toronto Arrival Departure Day 20:30 1 06:00 06:35 16:00 17:30 23:30 00:29 08:3008:55 21:15 23:00 3 4 4 5 00:48 01:18 10:00 II. Quit - stop the program from accepting any more commands TrainTimeTable a Attributes + LinkedList schedule E Operations + public void delay(String station, int minute) public void displaySchedule(O Station Attributes + private Date ival +private Date departure + private int day +private String city Operations +public Date getArrivalDateO) +public Date getDepartureDate) + public int getDay0 public Station(String city, Date arrival, Date departure, int day) public String getArrivalO) +public String getcityO +public String getDepartureC +public void setArrivalDate(Date arrival) + public void setCity (String city) +public void setDay(int day) +public void setDepartureDate(Date departure) Please note that class "Date" and class Calendar" are mutable in Java. You are welcome to use either "Date" or "Calendar", whichever seems easier for you to complete/solve the

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions