[Yan Zaiya] iP#211
Conversation
| this.isDone = false; | ||
| } | ||
|
|
||
| //... |
| System.out.println(greet); | ||
| boolean shouldContinue = true; | ||
| Scanner in = new Scanner(System.in); | ||
| //String[] tasks = new String[100]; |
There was a problem hiding this comment.
perhaps remove this comment if you are no longer using it
| } | ||
| System.out.println(DIVIDER_LINE); | ||
| }else if (action.startsWith("mark")){ | ||
| int dividerPos = action.indexOf(" "); |
There was a problem hiding this comment.
Perhaps you could spell out "position" or change it to "Index"
| System.out.println(DIVIDER_LINE + "Nice! I've marked this task as done:\n" | ||
| + tasks[toBeMarked].getStatusIcon() + " " + tasks[toBeMarked].description | ||
| + "\n" + DIVIDER_LINE); |
There was a problem hiding this comment.
I think this print statement is a bit lengthy. Perhaps you could use the ToString override method in your classes to shorten it
| String greet = DIVIDER_LINE | ||
| + "Hello! I'm Duke\n" | ||
| + "What can i do for you\n" | ||
| + DIVIDER_LINE; |
There was a problem hiding this comment.
Good job combining the welcome statement into one string
Thiolk
left a comment
There was a problem hiding this comment.
Overall, the code quality is great although you could consider using switch statements and shortening the print statements to improve the readability of the code.
| }else if (action.startsWith("mark")){ | ||
| int dividerPos = action.indexOf(" "); | ||
| int toBeMarked = Integer.parseInt(action.substring(dividerPos + 1)) - 1; | ||
| tasks[toBeMarked].markAsDone(); | ||
| System.out.println(DIVIDER_LINE + "Nice! I've marked this task as done:\n" | ||
| + tasks[toBeMarked].getStatusIcon() + " " + tasks[toBeMarked].description | ||
| + "\n" + DIVIDER_LINE); | ||
| }else if (action.startsWith("unmark")) { | ||
| int dividerPos = action.indexOf(" "); | ||
| int toBeUnmarked = Integer.parseInt(action.substring(dividerPos + 1)) - 1; | ||
| tasks[toBeUnmarked].markAsUndone(); | ||
| System.out.println(DIVIDER_LINE + "Nice! I've marked this task as undone:\n" | ||
| + tasks[toBeUnmarked].getStatusIcon() + " " + tasks[toBeUnmarked].description | ||
| + "\n" + DIVIDER_LINE); | ||
| }else { |
There was a problem hiding this comment.
Should there be a spacing between the curly brackets and the "else if" and the "else"?
| + tasks[toBeMarked].getStatusIcon() + " " + tasks[toBeMarked].description | ||
| + "\n" + DIVIDER_LINE); | ||
| }else if (action.startsWith("unmark")) { | ||
| int dividerPos = action.indexOf(" "); |
There was a problem hiding this comment.
Perhaps you could consider writing your variable name in full?
| System.out.println(Integer.toString(i + 1) + "." + "" +tasks[i].getStatusIcon() | ||
| + " " +tasks[i].description); | ||
| } | ||
| System.out.println(DIVIDER_LINE); | ||
| }else if (action.startsWith("mark")){ | ||
| int dividerPos = action.indexOf(" "); | ||
| int toBeMarked = Integer.parseInt(action.substring(dividerPos + 1)) - 1; | ||
| tasks[toBeMarked].markAsDone(); | ||
| System.out.println(DIVIDER_LINE + "Nice! I've marked this task as done:\n" | ||
| + tasks[toBeMarked].getStatusIcon() + " " + tasks[toBeMarked].description | ||
| + "\n" + DIVIDER_LINE); |
There was a problem hiding this comment.
Good job in ensuring that the character count of each line should not exceed 120 characters.
|
|
||
| @Override | ||
| public String toString(){ | ||
| return getTypeIcon() + super.getStatusIcon() +super.description + " (by: " + this.by + ")"; |
There was a problem hiding this comment.
Be consistent with the space around +
| public class Duke { | ||
| public static String DIVIDER_LINE = "______________________________\n"; | ||
|
|
||
| public static void main(String[] args) { |
There was a problem hiding this comment.
Your main method feels a bit long, can consider modularizing it. According to the textbook, the recommendation is to have 30 LOC.
| taskCount += 1; | ||
| printNumTask(taskCount); | ||
| }else if (action.startsWith("event")) { | ||
| int dividerPosition1 = action.indexOf("/from"); |
There was a problem hiding this comment.
You repeat this line of code quite often. Consider creating a method and passing the respective variable of /from or /by
conflicts resolved # Conflicts: # src/main/java/duke/Duke.java
resolved conflicts # Conflicts: # src/main/java/duke/Duke.java
added find function
Added JavaDoc
No description provided.