-
Notifications
You must be signed in to change notification settings - Fork 200
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
base: master
Are you sure you want to change the base?
[Yan Zaiya] iP #211
Conversation
src/main/java/Task.java
Outdated
this.isDone = false; | ||
} | ||
|
||
//... |
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.
Perhaps you could remove this comment
src/main/java/Duke.java
Outdated
System.out.println(greet); | ||
boolean shouldContinue = true; | ||
Scanner in = new Scanner(System.in); | ||
//String[] tasks = new String[100]; |
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.
perhaps remove this comment if you are no longer using it
src/main/java/Duke.java
Outdated
} | ||
System.out.println(DIVIDER_LINE); | ||
}else if (action.startsWith("mark")){ | ||
int dividerPos = action.indexOf(" "); |
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.
Perhaps you could spell out "position" or change it to "Index"
src/main/java/Duke.java
Outdated
System.out.println(DIVIDER_LINE + "Nice! I've marked this task as done:\n" | ||
+ tasks[toBeMarked].getStatusIcon() + " " + tasks[toBeMarked].description | ||
+ "\n" + DIVIDER_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.
I think this print statement is a bit lengthy. Perhaps you could use the ToString override method in your classes to shorten it
src/main/java/Duke.java
Outdated
String greet = DIVIDER_LINE | ||
+ "Hello! I'm Duke\n" | ||
+ "What can i do for you\n" | ||
+ DIVIDER_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.
Good job combining the welcome statement into one string
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.
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.
src/main/java/Duke.java
Outdated
}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 { |
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.
Should there be a spacing between the curly brackets and the "else if" and the "else"?
src/main/java/Duke.java
Outdated
+ tasks[toBeMarked].getStatusIcon() + " " + tasks[toBeMarked].description | ||
+ "\n" + DIVIDER_LINE); | ||
}else if (action.startsWith("unmark")) { | ||
int dividerPos = action.indexOf(" "); |
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.
Perhaps you could consider writing your variable name in full?
src/main/java/Duke.java
Outdated
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); |
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.
Good job in ensuring that the character count of each line should not exceed 120 characters.
src/main/java/Deadline.java
Outdated
|
||
@Override | ||
public String toString(){ | ||
return getTypeIcon() + super.getStatusIcon() +super.description + " (by: " + this.by + ")"; |
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.
Be consistent with the space around +
src/main/java/Duke.java
Outdated
public class Duke { | ||
public static String DIVIDER_LINE = "______________________________\n"; | ||
|
||
public static void main(String[] args) { |
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.
Your main method feels a bit long, can consider modularizing it. According to the textbook, the recommendation is to have 30 LOC.
src/main/java/Duke.java
Outdated
taskCount += 1; | ||
printNumTask(taskCount); | ||
}else if (action.startsWith("event")) { | ||
int dividerPosition1 = action.indexOf("/from"); |
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.
You repeat this line of code quite often. Consider creating a method and passing the respective variable of /from
or /by
conflicts resolved # Conflicts: # src/main/java/duke/Duke.java
resolved conflicts # Conflicts: # src/main/java/duke/Duke.java
added find function
Added JavaDoc
No description provided.