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

[lcsroy] iP #68

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

[lcsroy] iP #68

wants to merge 21 commits into from

Conversation

lcsroy
Copy link

@lcsroy lcsroy commented Aug 30, 2022

Level 3 still working in progress

Copy link

@chydarren chydarren left a 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! :)

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

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.

line = in.nextLine();
if (line.equals("bye")){
break;
}else if(line.compareTo("list") != 0) {

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.

}

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

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!

System.out.println("[" + t.getStatusIcon() + "] " + List[Integer.parseInt(line.substring(i))-1]);
} else {
System.out.println("added: " + line);
List[ListNo] = line;

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.

if (line.equals("bye")){
break;
}else if(line.compareTo("list") != 0) {
if(line.contains("mark")){

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.

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;

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.

Copy link

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

  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 on lines 17 to 21
do{
line = in.nextLine();
if (line.equals("bye")){
break;
}else if(line.compareTo("list") != 0) {
Copy link

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

break;
}else if(line.compareTo("list") != 0) {
if(line.contains("mark")){
int i = line.indexOf(" ") + 1;
Copy link

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 on lines 14 to 22
public boolean markAsDone(){
isDone = true;
return isDone;
}
public boolean unmarkAsNotDone(){
isDone = false;
return isDone;
}
}
Copy link

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