-
Notifications
You must be signed in to change notification settings - Fork 77
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
[lcsroy] iP #68
base: master
Are you sure you want to change the base?
[lcsroy] iP #68
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.
Well-written and organized code! Just a few minor tweaks needed, keep up the good work! :)
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; |
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.
Great that the purpose of the variable is described clearly, but do note that variable names must be in camelCase.
src/main/java/Duke.java
Outdated
line = in.nextLine(); | ||
if (line.equals("bye")){ | ||
break; | ||
}else if(line.compareTo("list") != 0) { |
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.
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.
src/main/java/Task.java
Outdated
} | ||
|
||
public String getStatusIcon(){ | ||
return (isDone ? "X" : " "); |
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.
Excellent use of an in-line conditional expression to make the code more intuitive!
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; |
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.
Note that array variables need to be in camelCase too. Pascal cases should only be used for class and enum declarations.
src/main/java/Duke.java
Outdated
if (line.equals("bye")){ | ||
break; | ||
}else if(line.compareTo("list") != 0) { | ||
if(line.contains("mark")){ |
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 would recommend using .startsWith() so that the use case can be more specific.
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; |
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'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.
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.
There are a few issues that I have noted.
- The PR title is incorrect. Please follow the given convention
- There are minimal updates since 19 days ago. I urge you to complete the iP tasks asap.
- If you are facing any issues in completing the iP tasks, please ping me for help.
src/main/java/Duke.java
Outdated
do{ | ||
line = in.nextLine(); | ||
if (line.equals("bye")){ | ||
break; | ||
}else if(line.compareTo("list") != 0) { |
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.
Spacing is an issue in this piece of code, not just for the if-else block as mentioned by chydarren
src/main/java/Duke.java
Outdated
break; | ||
}else if(line.compareTo("list") != 0) { | ||
if(line.contains("mark")){ | ||
int i = line.indexOf(" ") + 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.
Try to get rid of the spaces and use some other demarcator to help identify the command/parameter boundaries
src/main/java/Task.java
Outdated
public boolean markAsDone(){ | ||
isDone = true; | ||
return isDone; | ||
} | ||
public boolean unmarkAsNotDone(){ | ||
isDone = false; | ||
return isDone; | ||
} | ||
} |
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.
Two issues here:
- Spacing doesn't follow the coding standards
- please have some comments to all non-trivial classes and/or methods
Level 3 still working in progress