Skip to content

Commit

Permalink
Fix bug in Parser and Time. Added in Ui.png in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
YiJiee committed Sep 18, 2019
1 parent 56e341c commit 4b766fc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Binary file added docs/Ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main/java/main/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static Command parse(String fullCommand) throws DukeException {
c = new AdminCommand(commandComponents[0]);
} else if (commandComponents[0].equals("done")) {
c = new AdminCommand(commandComponents[0], Integer.parseInt(commandComponents[1]));
} else if (commandComponents[0].equals("delete")) {
} else if (commandComponents[0].equals("delete") && commandComponents.length == 2) {
c = new DeleteCommand(Integer.parseInt(commandComponents[1]));
} else if (commandComponents[0].equals("bye")) {
c = new ExitCommand();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/task/Time.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public Time(String time) {
*/
public String toString() {
int minutes = time % 100;
if (time > 1200) {
return ((time - 1200) / 100) + minutes + "pm";
if (time >= 1200) {
int t = time - 1200 == 0 ? 12 : (time - 1200)/ 100;
return t + minutes + "pm";
} else {
return (time / 100) + minutes + "am";
}
Expand Down

0 comments on commit 4b766fc

Please sign in to comment.