-
Notifications
You must be signed in to change notification settings - Fork 193
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
[wingho]IP #196
base: master
Are you sure you want to change the base?
[wingho]IP #196
Conversation
Change the initial string that printed
…t on bye Import a Scanner class and add a to that echo input.
…hen list is called Add a array of size 100 that store string
Add Task class iinstead of just storing the tasks as strings
Added 3 class that inherit 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.
Just some minor comments :)
src/main/java/Duke.java
Outdated
for (int i = 0; i < listIndex; i++) { | ||
System.out.println((i + 1) + ". " + list[i].toString()); | ||
} | ||
}else if(echoLower.startsWith("event")){ |
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.
Just a small issue, I think there should be spaces before "{" and after "}"
src/main/java/Duke.java
Outdated
Task t = new Deadline(description, deadline); | ||
list[listIndex] = t; | ||
listIndex += 1; | ||
System.out.println("Got it. I've added this task: " + System.lineSeparator() + t.toString() + System.lineSeparator() + "Now you have " + listIndex +" tasks in the list."); |
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 there are more than 120 characters in this line, maybe you could split it into 2 lines?
src/main/java/Duke.java
Outdated
Task t = new Event(description, time); | ||
list[listIndex] = t; | ||
listIndex += 1; | ||
System.out.println("Got it. I've added this task: " + System.lineSeparator() + t.toString() + System.lineSeparator() + "Now you have " + listIndex+" tasks in the list."); |
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 there are more than 120 characters in this line, maybe you could split it into 2 lines?
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.
Agree
src/main/java/Duke.java
Outdated
Task t = new Todo(description); | ||
list[listIndex] = t; | ||
listIndex += 1; | ||
System.out.println("Got it. I've added this task: " + System.lineSeparator() + t.toString() + System.lineSeparator() + "Now you have " + listIndex +" tasks in the list."); |
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 there are more than 120 characters in this line, maybe you could split it into 2 lines?
src/main/java/Duke.java
Outdated
" What can I do for you?\n" + | ||
"____________________________________________________________\n"); | ||
Scanner in = new Scanner(System.in); | ||
Task[] list = new Task[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.
Maybe can try using another name for the list? Just to make it clear what is being stored in here.
src/main/java/Task.java
Outdated
return description; | ||
} | ||
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.
Maybe you could consider using the full if statement.
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.
LGTM, just a few issues about coding standard need change
src/main/java/Task.java
Outdated
return description; | ||
} | ||
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.
return(isDone?"X":" "); | |
return(isDone ? "X" : " "); |
src/main/java/Duke.java
Outdated
} | ||
}else if(echoLower.startsWith("event")){ | ||
int startOfTime = echoLower.indexOf("/"); | ||
String description = echoLower.substring(6,startOfTime); |
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.
it is better to avoid magic number, e.g., 6
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.
it is better to avoid magic numbers, e.g., 6
src/main/java/Duke.java
Outdated
for(int i = 0; i < listIndex; i ++){ | ||
System.out.println((i + 1) + ". " + list[i].toString()); | ||
} | ||
}else if(echoLower.equals("done")) { |
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.
Just a very small issue of coding standard. Based on Checkstyle, there should be a space before else
and after if
here.
}else if(echoLower.equals("done")) { | |
} else if (echoLower.equals("done")) { |
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 great job, Wingho!
src/main/java/Deadline.java
Outdated
public class Deadline extends Task{ | ||
protected String by; | ||
public Deadline(String description, String by){ | ||
super(description); | ||
this.by = by; | ||
} | ||
public String toString(){ | ||
return "[D]" + super.toString() + "by: " + 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.
It is better to follow the coding standard where there is a space between the class name and the {. The same goes for methods.
src/main/java/Event.java
Outdated
@@ -0,0 +1,10 @@ | |||
public class Event extends Task{ | |||
protected String time; |
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.
It is better to make it a private string to ensure data hiding in encapsulation.
src/main/java/Task.java
Outdated
@@ -15,4 +15,7 @@ public String getDescription(){ | |||
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.
Please follow the coding standard in leaving spaces.
src/main/java/Deadline.java
Outdated
public String toString(){ | ||
return "[D]" + super.toString() + "by: " + 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.
It might be more readable if you add the @OverRide before overriding toString() method.
src/main/java/Duke.java
Outdated
}else if(echoLower.equals("list")) { | ||
for(int i = 0; i < listIndex; i ++){ | ||
System.out.println((i + 1) + ". ["+ list[i].getStatusIcon() + "] " + list[i].getDescription()); | ||
System.out.println((i + 1) + ". " + list[i].toString()); | ||
} | ||
}else if(echoLower.equals("done")) { |
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.
Please leave spaces for the if-else blocks, abiding by the coding standard.
src/main/java/Deadline.java
Outdated
public Deadline(String description, String by){ | ||
super(description); | ||
this.by = by; | ||
} | ||
public String toString(){ |
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 we need to have a blank line in between variables declared and method, as well as between two methods.
Improve the naming to be more descriptive of the variable it represent Use constants to remove the need for magic numbers Change array into arraylist to prevent overflow of task in the array
…y to set multiple task as done in the same line Added a interface to listManager to make it easier to know what listMananger does
…n user input Added a class artbot that use 2D array to create and merge the string to form the shape of letters
…n delete is called
Added a file class to interact with txt files
# Conflicts: # src/main/java/duke/ListManager.java
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.
Hi Wing Ho! Nice job here. I hope my comments might help you :)
src/main/java/duke/Duke.java
Outdated
fileManager.covertStringToTask(); | ||
while(isOnline) { | ||
String userInput = in.nextLine().toLowerCase().trim(); | ||
if (userInput.startsWith("!")) { |
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 a magic string here? maybe change to a named constant in case you are going to use it somewhere else...
src/main/java/duke/FileManager.java
Outdated
String[] splitString = s.split(";"); | ||
switch (splitString[0]){ | ||
case "[T]": | ||
listManager.addTodo(splitString[2], true); | ||
break; | ||
case "[E]": | ||
listManager.addEvent(splitString[2],splitString[3], true); | ||
break; | ||
case"[D]": | ||
listManager.addDeadline(splitString[2],splitString[3], true); |
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.
what does splitString[0], splitString[2], splitString[3] stands for? perhaps declare it giving specific names to improve understandability? e.g. splitString[0] -> taskType?
src/main/java/duke/FileManager.java
Outdated
case"[D]": | ||
listManager.addDeadline(splitString[2],splitString[3], true); | ||
} | ||
if (splitString[1].equals("[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.
perhaps change [X] to a constant?
src/main/java/duke/ListManager.java
Outdated
System.out.println(Logo.dividerWithoutNewLine); | ||
printAddItem(t); | ||
System.out.println(Logo.dividerWithoutNewLine); | ||
} |
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 improve understandability by apply the SLAP concept here? e.g a method to print these 3 lines of code?
src/main/java/duke/ListManager.java
Outdated
System.out.println(Logo.dividerWithoutNewLine); | ||
printAddItem(t); | ||
System.out.println(Logo.dividerWithoutNewLine); |
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.
same as line 99, repeated code here...
# Conflicts: # src/main/java/duke/Duke.java
No description provided.