Skip to content
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

Open
wants to merge 37 commits into
base: master
Choose a base branch
from

Conversation

tiffanyliu0220
Copy link

No description provided.

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

@leongxingyu leongxingyu left a 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!

String command = scanner.nextLine();

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

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

//Displays the list of tasks
System.out.println("Here are the tasks in your list: ");
for (int i = 0; i < counter; i ++) {
//

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

} 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 ++) {

Choose a reason for hiding this comment

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

i++ instead of i ++


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

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!

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

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

return -1;
}
}
}
Copy link

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.

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

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!

Copy link

@StanleyW00 StanleyW00 left a 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.

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(" ");

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