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

[Yan Zaiya] iP #211

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

[Yan Zaiya] iP #211

wants to merge 25 commits into from

Conversation

skyanzy
Copy link

@skyanzy skyanzy commented Feb 1, 2023

No description provided.

this.isDone = false;
}

//...
Copy link

Choose a reason for hiding this comment

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

Perhaps you could remove this comment

System.out.println(greet);
boolean shouldContinue = true;
Scanner in = new Scanner(System.in);
//String[] tasks = new String[100];
Copy link

Choose a reason for hiding this comment

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

perhaps remove this comment if you are no longer using it

}
System.out.println(DIVIDER_LINE);
}else if (action.startsWith("mark")){
int dividerPos = action.indexOf(" ");
Copy link

Choose a reason for hiding this comment

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

Perhaps you could spell out "position" or change it to "Index"

Comment on lines 40 to 42
System.out.println(DIVIDER_LINE + "Nice! I've marked this task as done:\n"
+ tasks[toBeMarked].getStatusIcon() + " " + tasks[toBeMarked].description
+ "\n" + DIVIDER_LINE);
Copy link

Choose a reason for hiding this comment

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

I think this print statement is a bit lengthy. Perhaps you could use the ToString override method in your classes to shorten it

Comment on lines 13 to 16
String greet = DIVIDER_LINE
+ "Hello! I'm Duke\n"
+ "What can i do for you\n"
+ DIVIDER_LINE;
Copy link

Choose a reason for hiding this comment

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

Good job combining the welcome statement into one string

Copy link

@Thiolk Thiolk left a comment

Choose a reason for hiding this comment

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

Overall, the code quality is great although you could consider using switch statements and shortening the print statements to improve the readability of the code.

Comment on lines 36 to 50
}else if (action.startsWith("mark")){
int dividerPos = action.indexOf(" ");
int toBeMarked = Integer.parseInt(action.substring(dividerPos + 1)) - 1;
tasks[toBeMarked].markAsDone();
System.out.println(DIVIDER_LINE + "Nice! I've marked this task as done:\n"
+ tasks[toBeMarked].getStatusIcon() + " " + tasks[toBeMarked].description
+ "\n" + DIVIDER_LINE);
}else if (action.startsWith("unmark")) {
int dividerPos = action.indexOf(" ");
int toBeUnmarked = Integer.parseInt(action.substring(dividerPos + 1)) - 1;
tasks[toBeUnmarked].markAsUndone();
System.out.println(DIVIDER_LINE + "Nice! I've marked this task as undone:\n"
+ tasks[toBeUnmarked].getStatusIcon() + " " + tasks[toBeUnmarked].description
+ "\n" + DIVIDER_LINE);
}else {
Copy link

Choose a reason for hiding this comment

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

Should there be a spacing between the curly brackets and the "else if" and the "else"?

+ tasks[toBeMarked].getStatusIcon() + " " + tasks[toBeMarked].description
+ "\n" + DIVIDER_LINE);
}else if (action.startsWith("unmark")) {
int dividerPos = action.indexOf(" ");
Copy link

Choose a reason for hiding this comment

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

Perhaps you could consider writing your variable name in full?

Comment on lines 32 to 42
System.out.println(Integer.toString(i + 1) + "." + "" +tasks[i].getStatusIcon()
+ " " +tasks[i].description);
}
System.out.println(DIVIDER_LINE);
}else if (action.startsWith("mark")){
int dividerPos = action.indexOf(" ");
int toBeMarked = Integer.parseInt(action.substring(dividerPos + 1)) - 1;
tasks[toBeMarked].markAsDone();
System.out.println(DIVIDER_LINE + "Nice! I've marked this task as done:\n"
+ tasks[toBeMarked].getStatusIcon() + " " + tasks[toBeMarked].description
+ "\n" + DIVIDER_LINE);
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 ensuring that the character count of each line should not exceed 120 characters.


@Override
public String toString(){
return getTypeIcon() + super.getStatusIcon() +super.description + " (by: " + this.by + ")";

Choose a reason for hiding this comment

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

Be consistent with the space around +

public class Duke {
public static String DIVIDER_LINE = "______________________________\n";

public static void main(String[] args) {

Choose a reason for hiding this comment

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

Your main method feels a bit long, can consider modularizing it. According to the textbook, the recommendation is to have 30 LOC.

taskCount += 1;
printNumTask(taskCount);
}else if (action.startsWith("event")) {
int dividerPosition1 = action.indexOf("/from");

Choose a reason for hiding this comment

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

You repeat this line of code quite often. Consider creating a method and passing the respective variable of /from or /by

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