Skip to content

[tiffanyliu0220] iP#185

Open
tiffanyliu0220 wants to merge 37 commits into
nus-cs2113-AY2324S2:masterfrom
tiffanyliu0220:master
Open

[tiffanyliu0220] iP#185
tiffanyliu0220 wants to merge 37 commits into
nus-cs2113-AY2324S2:masterfrom
tiffanyliu0220:master

Conversation

@tiffanyliu0220

Copy link
Copy Markdown

No description provided.

Level-0: Rename, Greet, Exit
Level-1, 2, 3
Level-1, 2, 3

@leongxingyu leongxingyu left a comment

Copy link
Copy Markdown

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!

Comment thread src/main/java/Sunny.java Outdated
String command = scanner.nextLine();

//If the user input is "bye"
if (command.equalsIgnoreCase("bye")){

Copy link
Copy Markdown

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

Comment thread 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 ++) {
//

Copy link
Copy Markdown

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

Comment thread 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 ++) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i++ instead of i ++

Comment thread src/main/java/Sunny.java Outdated

//Echoes commands after user says bye
while (true) {
//Gets user input

Copy link
Copy Markdown

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!

Comment thread 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());

Copy link
Copy Markdown

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 :)

Comment thread src/main/java/Sunny.java Outdated
return -1;
}
}
}

Copy link
Copy Markdown

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.

Comment thread 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

Copy link
Copy Markdown

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!

@StanleyW00 StanleyW00 left a comment

Copy link
Copy Markdown

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.

Comment thread src/main/java/Sunny.java Outdated
Comment on lines +51 to +59
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(" ");

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants