[Zhou Qi] iP#64
Conversation
jltha
left a comment
There was a problem hiding this comment.
There's a few suggestions I made for some areas of the code. Other than that, you might want to look at things to implement to give your own bot more personality so that it can stand out from the given template.
| import java.util.Scanner; | ||
|
|
||
| public class Duke { | ||
| public static String boundary = "____________________________________________________________" + System.lineSeparator(); |
There was a problem hiding this comment.
I like how you have included this boundary for ease of printing. Nice work!
| public static void addTask(String request) { | ||
| if (request.toLowerCase().startsWith("deadline")) { | ||
| int byPosition = request.indexOf("/"); | ||
| taskList[countTask] = new Deadline(request.substring(9, byPosition - 1), request.substring(byPosition + 4)); | ||
| } else if (request.toLowerCase().startsWith("event")) { | ||
| int atPosition = request.indexOf("/"); | ||
| taskList[countTask] = new Event(request.substring(6, atPosition - 1), request.substring(atPosition + 4)); | ||
| } else if (request.toLowerCase().startsWith("todo")) { | ||
| taskList[countTask] = new Todo(request.substring(5)); | ||
| } else { | ||
| taskList[countTask] = new Task(request); | ||
| } |
There was a problem hiding this comment.
Perhaps you can use a switch statement instead of multiple if-else statements? I noticed the same issue in your main as well
| line = in.nextLine(); | ||
| } | ||
| System.out.print(boundary + "Bye. Hope to see you again soon!" + System.lineSeparator() + boundary); | ||
| sayGoodbye(); |
There was a problem hiding this comment.
I like how you've abstracted the printing of your exit message. But perhaps the same can also be done for your welcome message and execution of inputs? You getting close, dont give up!
| @Override | ||
| public String toString() { | ||
| return "[E]" + super.toString() + " (at: " + at + ")"; | ||
| } | ||
| } |
There was a problem hiding this comment.
Nice, I see your usages of polymorphism in all your classes. Keep up the good work!
BradenTeo
left a comment
There was a problem hiding this comment.
Looks great overall! The variable and method names are named appropriately and apart from the minor cosmetic changes I suggested, the code is easy to read.
But I would also suggest for you to edit the text-ui-test files. It would not only help in debugging, but other reviewers can also see the output of your code without having to run it on their own IDEs.
|
|
||
| public static void printList() { | ||
| System.out.println(boundary + "Here are the tasks in your list:"); | ||
| for (int i = 0; i < countTask; i ++) { |
| taskList[countTask] = new Task(request); | ||
| } | ||
|
|
||
| countTask ++; |
There was a problem hiding this comment.
The spacing between "countTask" and "++" could be removed too.
| + "| |_| | |_| | < __/\n" | ||
| + "|____/ \\__,_|_|\\_\\___|\n"; | ||
| System.out.println("Hello from\n" + logo); | ||
| System.out.println(boundary+ logo); |
There was a problem hiding this comment.
It was probably a typo error, but you could add a space between "boundary" and "+"
| System.out.println("What can I do for you?" + System.lineSeparator() + boundary); | ||
| Scanner in = new Scanner(System.in); | ||
| String line = in.nextLine(); | ||
|
|
There was a problem hiding this comment.
Suggestion: Maybe this extra blank line can be removed? It might make the formatting look more standardised.
| @@ -0,0 +1,14 @@ | |||
| public class Event extends Task { | |||
|
|
|||
There was a problem hiding this comment.
I think this blank line can be removed? (So that it follows the formatting of the rest of your code)
| @@ -0,0 +1,14 @@ | |||
| public class Deadline extends Task { | |||
|
|
|||
There was a problem hiding this comment.
I think this blank line can be removed? (So that it follows the formatting of the rest of your code, where the class's attributes are directly under the class call)
Branch level 8
Branch level 9

No description provided.