Skip to content

[lcsroy] iP#68

Open
lcsroy wants to merge 21 commits into
nus-cs2113-AY2223S1:masterfrom
lcsroy:master
Open

[lcsroy] iP#68
lcsroy wants to merge 21 commits into
nus-cs2113-AY2223S1:masterfrom
lcsroy:master

Conversation

@lcsroy

@lcsroy lcsroy commented Aug 30, 2022

Copy link
Copy Markdown

Level 3 still working in progress

@chydarren chydarren 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.

Well-written and organized code! Just a few minor tweaks needed, keep up the good work! :)

Comment thread src/main/java/Duke.java Outdated
System.out.println("Hello! I'm Duke");
System.out.println("What can i do for you?");
String[] List = new String[100];
int ListNo = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great that the purpose of the variable is described clearly, but do note that variable names must be in camelCase.

Comment thread src/main/java/Duke.java Outdated
line = in.nextLine();
if (line.equals("bye")){
break;
}else if(line.compareTo("list") != 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For the if-else statement, try to maintain consistent spacing between the "}" brace and your "else if". Suppose your other cases you have a space between them, then try to maintain it throughout the code to neaten readability.

Comment thread src/main/java/Task.java Outdated
}

public String getStatusIcon(){
return (isDone ? "X" : " ");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Excellent use of an in-line conditional expression to make the code more intuitive!

Comment thread src/main/java/Duke.java Outdated
System.out.println("[" + t.getStatusIcon() + "] " + List[Integer.parseInt(line.substring(i))-1]);
} else {
System.out.println("added: " + line);
List[ListNo] = line;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note that array variables need to be in camelCase too. Pascal cases should only be used for class and enum declarations.

Comment thread src/main/java/Duke.java Outdated
if (line.equals("bye")){
break;
}else if(line.compareTo("list") != 0) {
if(line.contains("mark")){

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 would recommend using .startsWith() so that the use case can be more specific.

Comment thread src/main/java/Duke.java Outdated
System.out.println("Nice! I've marked this task as done:");
System.out.println("[" + t.getStatusIcon() + "] " + List[Integer.parseInt(line.substring(i))-1]);
} else if(line.contains("unmark")) {
int i = line.indexOf(" ") + 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.

I'm not quite able to decipher why we are counting the index of the space, maybe might want to add a comment to describe this part.

@okkhoy okkhoy 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.

There are a few issues that I have noted.

  1. The PR title is incorrect. Please follow the given convention
  2. There are minimal updates since 19 days ago. I urge you to complete the iP tasks asap.
  3. If you are facing any issues in completing the iP tasks, please ping me for help.

Comment thread src/main/java/Duke.java Outdated
Comment on lines +17 to +21
do{
line = in.nextLine();
if (line.equals("bye")){
break;
}else if(line.compareTo("list") != 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Spacing is an issue in this piece of code, not just for the if-else block as mentioned by chydarren

Comment thread src/main/java/Duke.java Outdated
break;
}else if(line.compareTo("list") != 0) {
if(line.contains("mark")){
int i = line.indexOf(" ") + 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.

Try to get rid of the spaces and use some other demarcator to help identify the command/parameter boundaries

Comment thread src/main/java/Task.java Outdated
Comment on lines +14 to +22
public boolean markAsDone(){
isDone = true;
return isDone;
}
public boolean unmarkAsNotDone(){
isDone = false;
return isDone;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Two issues here:

  1. Spacing doesn't follow the coding standards
  2. please have some comments to all non-trivial classes and/or methods

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.

3 participants