[Clarence Chua Ying How] iP#84
Conversation
shunyao643
left a comment
There was a problem hiding this comment.
Good effort! More comments within your code will make it easier to follow. You may want to consider methods to reduce "magic numbers".
|
|
||
| @Override | ||
| public String toString() { | ||
| return String.format("[D]%s (by: %s)", super.toString(), this.deadline); |
There was a problem hiding this comment.
I like how you used the String format method to do this - this looks much cleaner than what I did!
| } | ||
| } | ||
|
|
||
| } else if (input.contains("unmark ")) { |
There was a problem hiding this comment.
| } else if (input.contains("unmark ")) { | |
| } else if (input.startsWith("unmark ")) { |
Could startsWith be more appropriate?
|
|
||
| public String description; | ||
| public Boolean isDone = false; | ||
| public String mark = " "; |
There was a problem hiding this comment.
Is this still necessary given that you already have isDone?
| private static Scanner sc = new Scanner(System.in); | ||
| private static Task[] list = new Task[100]; | ||
| private static int taskCounter = 0; | ||
| private static String HORIZONTAL_LINE = "____________________________________________________________"; |
There was a problem hiding this comment.
Consider adding the final modifier to the string if it is a constant.
| import duke.task.*; | ||
| import duke.exception.*; |
There was a problem hiding this comment.
Import classes explicitly instead of using Wildcard (*), to comply with coding standards.
| public class Duke { | ||
|
|
||
| private static Scanner sc = new Scanner(System.in); | ||
| private static Task[] list = new Task[100]; |
There was a problem hiding this comment.
Consider renaming "list" to make it clearer on what the variable is storing. Perhaps "tasks" would be more suitable?
| } else if (input.contains("unmark")) { | ||
| handleUnmark(input); | ||
|
|
||
| } else if (input.contains("mark")) { | ||
| handleMark(input); | ||
|
|
||
| } else if (input.contains("todo")) { | ||
| handleToDo(input); |
There was a problem hiding this comment.
Consider refactoring magic strings such as "unmark", "mark" into constants.
|
|
||
| private static void handleUnmark(String input) throws AlreadyUnmarkedException, InvalidNumberException { | ||
| int markInt = Integer.parseInt(input.substring(7)) - 1; | ||
| if (markInt + 1> taskCounter) { |
There was a problem hiding this comment.
Try to standardize spaces before and after operators e.g markInt + 1 > taskCounter
No description provided.