[Nguyen Quang Anh] iP#202
Conversation
… mark and unmark task
…compliance with coding standard
MustafaAH10
left a comment
There was a problem hiding this comment.
Code is overall of good quality and has minimal errors.
| if (userCmd.equals("list")) { | ||
| listofItems.listTask(); | ||
| } else if (WordsinUserCmd[0].equals("mark")) { | ||
| } else if (userCmdasWords[0].equals("mark")) { |
There was a problem hiding this comment.
userCmdasWords is a bit confusing to reader.
| @@ -0,0 +1,40 @@ | |||
| public class TaskManager { | |||
| private Task[] tasks = new Task[100]; | |||
| private int tasksCount = 0; | |||
There was a problem hiding this comment.
Can be taskCount instead of tasksCount to follow naming convention.
| @@ -0,0 +1,40 @@ | |||
| public class Task { | |||
| private String name; | |||
| private boolean isDone; | |||
There was a problem hiding this comment.
Boolean name is good as status is intuitive.
| tasksCount++; | ||
| } | ||
|
|
||
| public void markTask(int id) { |
There was a problem hiding this comment.
Can consider combining markTask and unmarkTask into one function.
kaceycsn
left a comment
There was a problem hiding this comment.
Looks good! Code generally follows the coding standard. Some suggestions are given.
| } | ||
|
|
||
| public void listTask() { | ||
| int j = 1; |
There was a problem hiding this comment.
Consider changing the variable name. Variables named j, k etc. should be used for nested loops only.
| int j = 1; | |
| int counter = 1; |
| @@ -0,0 +1,40 @@ | |||
| public class TaskManager { | |||
| private Task[] tasks = new Task[100]; | |||
There was a problem hiding this comment.
Great! Array specifiers is attached to the type not the variable.
| while (!userCmd.equals("bye")) { | ||
| String[] userCmdasWords = userCmd.split(" "); | ||
| System.out.println(userCmdasWords[0]); | ||
| if (userCmd.equals("list")) { |
There was a problem hiding this comment.
Perhaps you can consider using switch instead of multiple if-else statements to make your code cleaner and more readable
| this.name = name; | ||
| } | ||
|
|
||
| public boolean IsDone() { |
There was a problem hiding this comment.
Consider changing method name. Method names must be in camelCase.
…ng methods in classes to make code neater
bdthanh
left a comment
There was a problem hiding this comment.
LGTM! However, you should careful with method and variable naming. I can just find several minor coding standard violations then good job! Good luck on your upcoming tasks
| } else { | ||
| return " [E][ ]" + this.getName() + " (from: " + this.startTime | ||
| + " to: " + this.finishTime + ")"; | ||
| } |
There was a problem hiding this comment.
else block are unnecessary. You can move the code inside else block out and put it after if block. Same with other if else block
| } | ||
|
|
||
| public String toString() { | ||
| if(this.getIsDone() == true) { |
There was a problem hiding this comment.
You should add space between if and condition statement
| public static void falseInput() { | ||
| System.out.println("Sorry Duke could not understand your input :> please follow the instructions"); | ||
| printInstructions(); | ||
| } |
There was a problem hiding this comment.
Method's name should start with a verb for example announceFalseInput. Same with firstWord method below
…nd Storage classes
No description provided.