-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tiffanyliu0220] iP #185
base: master
Are you sure you want to change the base?
[tiffanyliu0220] iP #185
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, code is easy to follow! Slight edits to your braces placements would comply with the coding standard better! Jiayous! LGTM!
src/main/java/Sunny.java
Outdated
String command = scanner.nextLine(); | ||
|
||
//If the user input is "bye" | ||
if (command.equalsIgnoreCase("bye")){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
src/main/java/Sunny.java
Outdated
//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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean up code to remove random comments
src/main/java/Sunny.java
Outdated
} 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 ++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i++ instead of i ++
src/main/java/Sunny.java
Outdated
|
||
//Echoes commands after user says bye | ||
while (true) { | ||
//Gets user input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Goodjob on indenting the comments correctly!
src/main/java/Sunny.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe can consider wrapping lines for longer codes :)
src/main/java/Sunny.java
Outdated
return -1; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job in adding an error prompt so that the users know what goes wrong.
src/main/java/Sunny.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job in adding comments so the readers know what they are reading!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/main/java/Sunny.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could separate each cases into different methods to make the method shorter.
# Conflicts: # src/main/java/Sunny.java
No description provided.