[Cheng-Zhiyuan] iP#176
Conversation
venicephua
left a comment
There was a problem hiding this comment.
Overall very clear and easy to read!
|
|
||
| protected String dateRange; | ||
|
|
||
| public Event(String description, String dateRange, String to) { |
| while (true) { | ||
| userInput = ui.readInput(); | ||
| // exit condition | ||
| if (userInput.equals("bye")) { |
There was a problem hiding this comment.
perhaps can consider using switch-case instead of if-else since there are quite a few if-else statements?
| TaskManager taskManager = new TaskManager(); | ||
| UserInterface ui = new UserInterface(); | ||
|
|
||
| // Print Greeting. |
There was a problem hiding this comment.
perhaps can remove these comments as it is rather intuitive from the variable names/functions?
| } | ||
|
|
||
| public static void printMarkAsDone(Task task) { | ||
| System.out.printf(INDENT + "Nice! I've marked this task as done:%n", ""); |
There was a problem hiding this comment.
perhaps can define these messages as constants to make the code cleaner?
| @@ -0,0 +1,27 @@ | |||
| // For Task commands | |||
| public class TaskManager { | |||
| public static final int MAX_TASKS = 100; | |||
There was a problem hiding this comment.
good work naming constants in all caps
| public static final String MARKED_BOX = "[X]"; | ||
|
|
||
| protected String description; | ||
| protected boolean isDone; |
| this.isDone = false; | ||
| } | ||
|
|
||
| public void markAsDone() { |
There was a problem hiding this comment.
good job in using camel case for methods
| super(description); | ||
| } | ||
|
|
||
| @Override |
| @@ -0,0 +1,51 @@ | |||
| import java.util.Scanner; | |||
thomasjlalba
left a comment
There was a problem hiding this comment.
Great work so far on your iP! Just minor nitpicks on the code quality and standards that I have suggested
|
|
||
| public class Thoth { | ||
|
|
||
| public static void main(String[] args) { |
There was a problem hiding this comment.
I quite like how you have done quite a bit of abstraction to simpler methods throughout your repo!
| int taskIndex = Integer.parseInt(userInput.replace("mark", "").trim()) - 1; | ||
| return new MarkCommand(taskIndex); | ||
| } catch (NumberFormatException e) { | ||
| return new UnknownCommand("Please enter a valid number for mark command."); |
There was a problem hiding this comment.
Maybe you can try to avoid magic literals
| if (timeParts.length > 1) { | ||
| to = timeParts[1].trim(); // Extracts "4pm" | ||
| } | ||
| } |
There was a problem hiding this comment.
Maybe you can add a final else statement to catch any unwanted errors
| public static Command parse(String userInput) { | ||
| userInput = userInput.trim(); | ||
|
|
||
| if (userInput.equals("bye")) { |
There was a problem hiding this comment.
Small nitpick but maybe you can standardise the spacing between the if/else statements if(statement){ vs if (statement) {
There was a problem hiding this comment.
Noted I will make changes. Thank you~
Remove magic literals
Update Parser Class with FindCommand
Add in javadoc headers
Fix bug for out of bound task index
Added Level-0, Level-1, Level-2 and Level-3 commits with respective tags.