Conversation
| @@ -0,0 +1,3 @@ | |||
| public enum CommandType { | |||
| System.out.println("───────────────────────────────────────────────────────────────────────"); | ||
| } | ||
|
|
||
| public static void greeting() { |
| Scanner input = new Scanner(System.in); | ||
| String line; | ||
|
|
||
| Todo[] tasks = new Todo[100]; |
There was a problem hiding this comment.
magic number 100, can be put as constant instead
|
|
||
| switch (command) { | ||
| case TODO: | ||
| tasks[itemCount] = new Todo(line.substring(4)); |
| @Override | ||
| public String toString() { | ||
| return typeOfTask + taskStatus + " " + task; | ||
| } |
| @@ -0,0 +1,13 @@ | |||
| public class Event extends Todo{ | |||
| protected String at; | |||
There was a problem hiding this comment.
what is this variable representing? Maybe you can have a more descriptive name for the variable
| Scanner input = new Scanner(System.in); | ||
| String line; | ||
|
|
||
| Todo[] tasks = new Todo[100]; |
There was a problem hiding this comment.
You can create a constant variable for the number 100 since it wont be changed
| break; | ||
| case UNMARK: | ||
| int unmarkedItem = Integer.parseInt(line.substring(7)) - 1; | ||
| tasks[unmarkedItem].unmark(); |
There was a problem hiding this comment.
try not to have so many hard coded and same numbers in the switch statement
| @@ -0,0 +1,3 @@ | |||
| public enum CommandType { | |||
| TODO, DEADLINE, EVENT, MARK, UNMARK, LIST, NIL | |||
| package util.miscellaneous; | ||
|
|
||
| public interface Chatbot { | ||
| String LOGO = " ____ _ \n" |
There was a problem hiding this comment.
Good job here with declaring constants, and avoiding magic numbers later!
| + "| |_| | |_| | < __/\n" | ||
| + "|____/ \\__,_|_|\\_\\___|\n"; | ||
| System.out.println("Hello from\n" + logo); | ||
| Scanner input2 = new Scanner(System.in); |
There was a problem hiding this comment.
If this is input2, is there an input1? Consider a different name to explain and distinguish between variables.
| String IO_ERROR_MSG = " Oh no! File IO error just occurred."; | ||
| String NO_PREVIOUS_RECORD = " There is currently no save file."; | ||
|
|
||
|
|
There was a problem hiding this comment.
Additional blank lines could be removed to increase code quality and consistency.
| System.out.println("\t" + GREETING_MSG_01); | ||
| System.out.println("\t" + GREETING_MSG_02); | ||
| linePrinter(); | ||
|
|
There was a problem hiding this comment.
There are blank lines like these before the closed curly brackets, yet other methods do not have this empty line. You could make the layout more consistent.
| } | ||
|
|
||
| public static CommandType findCommandType(String line) { | ||
| CommandType c; |
There was a problem hiding this comment.
Instead of naming with c, you could consider renaming as a noun for better code quality.
| case MARK: | ||
| int markedItem = Integer.parseInt(line.substring(MARKED_ITEM_INDEX)) - 1; | ||
|
|
||
| if ((markedItem < 0) || (markedItem >= tasks.size())) { |
There was a problem hiding this comment.
This compound boolean expression could be defined in intermediate steps.
| } | ||
| } | ||
|
|
||
| public static void loadAndRun(ArrayList<Task> tasks, String line, boolean isLoadingData, boolean needUpdateTaskStatus) { |
Add some other documentation
Add documentation
Do everything from week 1 to week 4