blob: 1cc52b1ca093fdc64c6a052e08b988f2179c3bf1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# Learning Profile for Assignment #2 Question #10
## Name: Mo Khan
### Student ID: 3431709
1. Problem Statement
A train timetable for a train travelling between Vancouver and Toronto is
given below.
| Station | Arrival | Departure | Day |
| --- | --- | --- | --- |
| Vancouver | | 20:30 | 1 |
| Kamloops | 06:00 | 06:35 | 2 |
| Jasper | 16:00 | 17:30 | 2 |
| Edmonton | 23:00 | 23:59 | 2 |
| Saskatchewan | 08:00 | 08:25 | 3 |
| Winnipeg | 20:45 | 22:30 | 3 |
| Sioux Lookout | 05:02 | 05:42 | 4 |
| Hornepayne | 15:35 | 16:10 | 4 |
| Capreol | 00:18 | 00:48 | 5 |
| Toronto | 09:30 | | 5 |
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:
1. Show - shows the full table
1. Delay `<station><minutes>` - the arrival of the train is delayed by `<minutes>`
at station `<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 departures as well. The result of this
`Delay` commadn is shown below:
| Station | Arrival | Departure | Day |
| --- | --- | --- | --- |
| Vancouver | | 20:30 | 1 |
| Kamloops | 06:00 | 06:35 | 2 |
| Jasper | 16:00 | 17:30 | 2 |
| Edmonton | 23:30 | 00:29 | 3 |
| Saskatchewan | 08:30 | 08:55 | 3 |
| Winnipeg | 21:15 | 23:00 | 3 |
| Sioux Lookout | 05:32 | 06:12 | 4 |
| Hornepayne | 16:05 | 16:40 | 4 |
| Capreol | 00:48 | 01:18 | 5 |
| Toronto | 10:00 | | 5 |
1. Quit - stop the program from accepting any more commands.
1. Description of the Code
1. Errors and Warnings
1. Sample Input and Output
1. Discussion
|