[tiffanyliu0220] iP#185
Conversation
leongxingyu
left a comment
There was a problem hiding this comment.
Overall, code is easy to follow! Slight edits to your braces placements would comply with the coding standard better! Jiayous! LGTM!
| String command = scanner.nextLine(); | ||
|
|
||
| //If the user input is "bye" | ||
| if (command.equalsIgnoreCase("bye")){ |
There was a problem hiding this comment.
Add a space after before the opening brace.
e.g "if (condition) {" instead of "if (condition){"
same for other if else and else if statements
| //Displays the list of tasks | ||
| System.out.println("Here are the tasks in your list: "); | ||
| for (int i = 0; i < counter; i ++) { | ||
| // |
There was a problem hiding this comment.
Clean up code to remove random comments
| } else if (command.equalsIgnoreCase("list")){ | ||
| //Displays the list of tasks | ||
| System.out.println("Here are the tasks in your list: "); | ||
| for (int i = 0; i < counter; i ++) { |
|
|
||
| //Echoes commands after user says bye | ||
| while (true) { | ||
| //Gets user input |
There was a problem hiding this comment.
Goodjob on indenting the comments correctly!
| if (taskIndex > 0 && taskIndex <= counter) { | ||
| tasks[taskIndex - 1].markAsDone(); | ||
| System.out.println("Nice! I've marked this task as done:"); | ||
| System.out.println("[" + tasks[taskIndex - 1].getStatusIcon() + "] " + tasks[taskIndex - 1].getDescription()); |
There was a problem hiding this comment.
Maybe can consider wrapping lines for longer codes :)
| return -1; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Good job in adding an error prompt so that the users know what goes wrong.
| public static void main(String[] args) { | ||
| String chatBotName = "Sunny"; | ||
| Task[] tasks = new Task[100]; //Fixed-size array to store tasks | ||
| int counter = 0; //Counter to keep track of the number of tasks |
There was a problem hiding this comment.
Good job in adding comments so the readers know what they are reading!
StanleyW00
left a comment
There was a problem hiding this comment.
Overall, you managed to follow coding standards and manage to maintain some code quality. However, it seems that you are falling behind on the increments. Please try to catch up with the incremental tasks for each week.
| int taskIndex = extractTaskIndex(command); | ||
| if (taskIndex > 0 && taskIndex <= counter) { | ||
| tasks[taskIndex - 1].unmarkAsDone(); | ||
| System.out.println("OK, I've marked this task as not done yet:"); | ||
| System.out.println("[" + tasks[taskIndex - 1].getStatusIcon() + "] " + tasks[taskIndex - 1].getDescription()); | ||
| } else { | ||
| System.out.println(" Invalid task index. Please provide a valid task index."); | ||
| } | ||
| System.out.println(" "); |
There was a problem hiding this comment.
Perhaps you could separate each cases into different methods to make the method shorter.
# Conflicts: # src/main/java/Sunny.java
No description provided.