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
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.
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.
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.
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 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.
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.
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.
Maybe you could consider using the full if statement.
Yuxinn-J
left a comment
There was a problem hiding this comment.
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.
| 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.
it is better to avoid magic number, e.g., 6
There was a problem hiding this comment.
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.
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")) { |
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.
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.
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.
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.
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.
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.
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
rafaelperes
left a comment
There was a problem hiding this comment.
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.
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.
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]")){ |
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.
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.
same as line 99, repeated code here...
# Conflicts: # src/main/java/duke/Duke.java
No description provided.