[Sebastian Soewanto] iP#205
Conversation
DavidVin357
left a comment
There was a problem hiding this comment.
LGTM, just several naming proposals :)
Also, maybe consider switch case instead of lots if else statements. Some comments for explaining specific variables might also be nice.
Overall, it's fine in terms of code standard.
| + "| |_| | |_| | < __/\n" | ||
| + "|____/ \\__,_|_|\\_\\___|\n"; | ||
|
|
||
| String line = "____________________________________________________\n"; |
There was a problem hiding this comment.
Seems like it is a constant, so maybe consider using static final LINE_DIVIDER (or some other similar name)?
| String line = "____________________________________________________\n"; | ||
| System.out.println("Hello from\n" + logo); | ||
| System.out.print(line + "Hello! I'm Duke\n" + "What can I do for you?\n" + line); | ||
| String[] list = new String[100]; |
There was a problem hiding this comment.
I think you use this list to store the different tasks, so maybe it's better to name it as tasks? :)
| String[] list = new String[100]; | ||
| boolean[] isDone = new boolean[100]; | ||
| String toFill; | ||
| int listCount = 0; |
There was a problem hiding this comment.
Maybe something like tasksCount can tell better on what you are counting here?
| System.out.print(line + "Hello! I'm Duke\n" + "What can I do for you?\n" + line); | ||
| String[] list = new String[100]; | ||
| boolean[] isDone = new boolean[100]; | ||
| String toFill; |
There was a problem hiding this comment.
I think naming it checkerContent or some other noun may better represent the meaning of the variable (verbs are more suitable to be used for the methods)
| else { | ||
| toFill = " "; | ||
| } | ||
| System.out.println(i + 1 + ". [" + toFill + "] " + list[i]); |
There was a problem hiding this comment.
Extracting i+1 to another line as i++ may make the code a little bit more clean)
| String line = "____________________________________________________\n"; | ||
| System.out.println("Hello from\n" + logo); | ||
| System.out.print(line + "Hello! I'm Duke\n" + "What can I do for you?\n" + line); | ||
| String[] list = new String[100]; |
There was a problem hiding this comment.
Naming of ' String[ ] list ' is quite vague, maybe if possible to provide a more useful name for readability? e.g. ' String [ ] taskList '
| System.out.println(line + "Nice! I've marked this task as done:\n" + " [X] " + list[mark - 1]); | ||
| System.out.print(line); | ||
| } else if (input.startsWith("unmark")) { | ||
| int unmark = Integer.parseInt(input.substring(7)); |
There was a problem hiding this comment.
The naming of ' unmark' is a bit confusing, maybe switch to ' taskToUnmark '?
| isDone[unmark - 1] = false; | ||
| System.out.println(line + "OK, I've marked this task as not done yet:\n" + " [ ] "+ list[unmark - 1]); | ||
| System.out.print(line); | ||
| } else if(input.equals("list")) { |
There was a problem hiding this comment.
Good indentation and presenting the conditional statements, which helps the code's readability.
| + "|____/ \\__,_|_|\\_\\___|\n"; | ||
|
|
||
| String line = "_________________________________\n"; | ||
| String line = "____________________________________________________\n"; |
There was a problem hiding this comment.
Naming can be changed to avoid confusion down the code block, could change to -> e.g. 'static final String margin' (since its a repeating string pattern to be printed out)
| String line = "____________________________________________________\n"; | ||
| System.out.println("Hello from\n" + logo); | ||
| System.out.print(line + "Hello! I'm Duke\n" + "What can I do for you?\n" + line); | ||
| Task[] task = new Task[100]; |
There was a problem hiding this comment.
since the number of task can be more than 100. you can consider to use the dynamic size array list
| String logo = " ____ _ \n" | ||
| + "| _ \\ _ _| | _____ \n" | ||
| + "| | | | | | | |/ / _ \\\n" | ||
| + "| |_| | |_| | < __/\n" | ||
| + "|____/ \\__,_|_|\\_\\___|\n"; | ||
|
|
||
| String line = "____________________________________________________\n"; |
There was a problem hiding this comment.
Constant should be named by CAPITAL LETTER for example String DIVIDER, String LOGO
| String line = "____________________________________________________\n"; | ||
| System.out.println("Hello from\n" + logo); | ||
| System.out.print(line + "Hello! I'm Duke\n" + "What can I do for you?\n" + line); | ||
| Task[] task = new Task[100]; |
There was a problem hiding this comment.
task should be renamed to tasks (with s)
Updated class methods.

Up to level 3