Skip to content

[wingho]IP#196

Open
kum-wh wants to merge 90 commits intonus-cs2113-AY2122S1:masterfrom
kum-wh:master
Open

[wingho]IP#196
kum-wh wants to merge 90 commits intonus-cs2113-AY2122S1:masterfrom
kum-wh:master

Conversation

@kum-wh
Copy link
Copy Markdown

@kum-wh kum-wh commented Sep 2, 2021

No description provided.

wingho2 added 5 commits September 2, 2021 02:57
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
Copy link
Copy Markdown

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

Comment thread 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")){
Copy link
Copy Markdown

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 "}"

Comment thread 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.");
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 think there are more than 120 characters in this line, maybe you could split it into 2 lines?

Comment thread 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.");
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 think there are more than 120 characters in this line, maybe you could split it into 2 lines?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agree

Comment thread 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.");
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 think there are more than 120 characters in this line, maybe you could split it into 2 lines?

Comment thread 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];
Copy link
Copy Markdown

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.

Comment thread src/main/java/Task.java Outdated
return description;
}
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.

Maybe you could consider using the full if statement.

Copy link
Copy Markdown

@Yuxinn-J Yuxinn-J left a 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

Comment thread src/main/java/Task.java Outdated
return description;
}
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.

Suggested change
return(isDone?"X":" ");
return(isDone ? "X" : " ");

Comment thread src/main/java/Duke.java Outdated
}
}else if(echoLower.startsWith("event")){
int startOfTime = echoLower.indexOf("/");
String description = echoLower.substring(6,startOfTime);
Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

Comment thread 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")) {
Copy link
Copy Markdown

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.

Suggested change
}else if(echoLower.equals("done")) {
} else if (echoLower.equals("done")) {

Copy link
Copy Markdown

@ruyian ruyian left a 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!

Comment thread src/main/java/Deadline.java Outdated
Comment on lines +1 to +9
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 + ")";
}
Copy link
Copy Markdown

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.

Comment thread src/main/java/Event.java Outdated
@@ -0,0 +1,10 @@
public class Event extends Task{
protected String time;
Copy link
Copy Markdown

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.

Comment thread src/main/java/Task.java Outdated
@@ -15,4 +15,7 @@ public String getDescription(){
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.

Please follow the coding standard in leaving spaces.

Comment thread src/main/java/Deadline.java Outdated
Comment on lines +7 to +8
public String toString(){
return "[D]" + super.toString() + "by: " + by + ")";
Copy link
Copy Markdown

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.

Comment thread src/main/java/Duke.java Outdated
Comment on lines 27 to 31
}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")) {
Copy link
Copy Markdown

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.

Comment thread src/main/java/Deadline.java Outdated
Comment on lines +3 to +7
public Deadline(String description, String by){
super(description);
this.by = by;
}
public String toString(){
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 think we need to have a blank line in between variables declared and method, as well as between two methods.

wingho2 added 18 commits September 4, 2021 11:59
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
Added a file class to interact with txt files
# Conflicts:
#	src/main/java/duke/ListManager.java
Copy link
Copy Markdown

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

Comment thread src/main/java/duke/Duke.java Outdated
fileManager.covertStringToTask();
while(isOnline) {
String userInput = in.nextLine().toLowerCase().trim();
if (userInput.startsWith("!")) {
Copy link
Copy Markdown

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

Comment thread src/main/java/duke/FileManager.java Outdated
Comment on lines +51 to +60
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);
Copy link
Copy Markdown

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?

Comment thread src/main/java/duke/FileManager.java Outdated
case"[D]":
listManager.addDeadline(splitString[2],splitString[3], true);
}
if (splitString[1].equals("[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.

perhaps change [X] to a constant?

Comment thread src/main/java/duke/ListManager.java Outdated
Comment on lines +99 to +102
System.out.println(Logo.dividerWithoutNewLine);
printAddItem(t);
System.out.println(Logo.dividerWithoutNewLine);
}
Copy link
Copy Markdown

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?

Comment thread src/main/java/duke/ListManager.java Outdated
Comment on lines +109 to +111
System.out.println(Logo.dividerWithoutNewLine);
printAddItem(t);
System.out.println(Logo.dividerWithoutNewLine);
Copy link
Copy Markdown

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

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.

6 participants