summaryrefslogtreecommitdiff
path: root/src/Q10/README.md
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2019-08-11 15:59:50 -0600
committermo khan <mo@mokhan.ca>2019-08-11 15:59:50 -0600
commita117798660cf949ddc12f335fc547141a0f3d53f (patch)
tree146681661622530cc28ddb816cb1e70ede8d922c /src/Q10/README.md
parenta70558eb11c09c510897032a04143a79e7dd72a9 (diff)
add some error handling
Diffstat (limited to 'src/Q10/README.md')
-rw-r--r--src/Q10/README.md72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/Q10/README.md b/src/Q10/README.md
index 1cc52b1..4e31e37 100644
--- a/src/Q10/README.md
+++ b/src/Q10/README.md
@@ -51,6 +51,78 @@
1. Quit - stop the program from accepting any more commands.
1. Description of the Code
+ There are two classes. `TrainTimeTable` is responsible for add a delay in
+ minutes starting for a specific station. `Station` is responsible for managing
+ the arrival and departure time to/from a specific train station.
+
+ When a delay is added to the time table the code will add the delay to the
+ station, then to each station after it.
+
+ It would have been easier to represent dates as a unix timestamp, which is the
+ number of seconds since the UNIX epoch.
+ The Java Date class prefers to use millisecond precision.
+
+ All dates are represented using the UTC timezone.
+
+ I chose to add a method/constructor overloads to make the API of each of the
+ classes easier to unit test.
+ This also helped the class design to better adhere to the open/closed principle.
+
1. Errors and Warnings
+
+ When an unknown command is entered, the prompt is shown again.
+
+ ```bash
+ モ mvn package
+ モ java -cp target/assignment2*.jar ca.mokhan.comp268.App 10
+ === Question 10 ===
+
+ Enter command (Show, Delay, Quit):
+ invalid
+ Unknown command
+
+ Enter command (Show, Delay, Quit):
+ ```
+
+ When an unknown city is entered, an error is displayed.
+
+ ```bash
+ モ mvn package
+ モ java -cp target/assignment2*.jar ca.mokhan.comp268.App 10
+ === Question 10 ===
+
+ Enter command (Show, Delay, Quit):
+ Delay Calgary 25
+ `Calgary` is not on the schedule
+
+ Enter command (Show, Delay, Quit):
+ ```
+
+ When a non-numeric value is entered for minutes, an error is displayed.
+
+ ```bash
+ java -cp target/assignment2*.jar ca.mokhan.comp268.App 10
+ === Question 10 ===
+
+ Enter command (Show, Delay, Quit):
+ Delay Edmonton blah
+ Invalid minutes entered
+
+ Enter command (Show, Delay, Quit):
+ ```
+
+ When a delay of greater than 48 hours is entered, an error is displayed.
+
+ ```bash
+ java -cp target/assignment2*.jar ca.mokhan.comp268.App 10
+ === Question 10 ===
+
+ Enter command (Show, Delay, Quit):
+ Delay Edmonton 9999
+ Invalid minutes entered
+
+ Enter command (Show, Delay, Quit):
+ ```
+
1. Sample Input and Output
1. Discussion