[Hu Wenqi] iP - #95
Conversation
Implement an initial skeletal version of the Duke that simply greets the user and exits.
Simply echos commands entered by the user, and exits when the user types "bye".
Add the ability to store whatever text entered by the user and display them back to the user when requested.
Add the ability to mark tasks as done.
haven't dealt with input yet
Assuming all input are correct format
RainyCodeWizard
left a comment
There was a problem hiding this comment.
There are some coding standard violations, but overall good quality code!
| public static String readPrompt(Scanner in){ | ||
| return in.nextLine(); | ||
| } | ||
| /* |
There was a problem hiding this comment.
Maybe the comment can be removed, as we are not using it in the code.
There was a problem hiding this comment.
Yeah is this a leftover from some debugging you were doing? please remove
|
|
||
| private static void addToList(Task[] tasks, String prompt, int taskIndex, String taskType) { | ||
| int cutOffPoint = 0; | ||
| switch(taskType) { |
There was a problem hiding this comment.
Consider removing indentations for the case clauses. (It violates coding standard)
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| String logo = " ____ _ \n" |
There was a problem hiding this comment.
Consider removing the logo variable can be deleted. (It is not used in the rest of the code)
| public String toString() { | ||
| return "[" + getStatusIcon() + "] " + getDescription(); | ||
| } | ||
|
|
There was a problem hiding this comment.
Maybe it is better to remove the extra line spacings.
| this.at = at; | ||
| } | ||
|
|
||
| @Override |
| public static String readPrompt(Scanner in){ | ||
| return in.nextLine(); | ||
| } | ||
| /* |
There was a problem hiding this comment.
Yeah is this a leftover from some debugging you were doing? please remove
| this.isDone = false; | ||
| totalTasks ++; | ||
| } | ||
| //"\u2713" = tick symbol, "\u2718" = cross symbol |
There was a problem hiding this comment.
Good of you to comment this so that readers can know what the unicode symbols are
| tasks[taskIndex].markAsDone(); | ||
| System.out.println("\tNice! I've marked this task as done: \n" + | ||
| "\t" + tasks[taskIndex].toString()); | ||
| //bug here: does not deal with overflow values of input |
There was a problem hiding this comment.
Nice comment. Mentioning possible bugs for reviewers is great
| 1. Select the project directory, and click `OK` | ||
| 1. If there are any further prompts, accept the defaults. | ||
| 1. After the importing is complete, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()`. If the setup is correct, you should see something like the below: | ||
| 1. After the importing is complete, locate the `src/main/java/duke.Duke.java` file, right-click it, and choose `Run duke.Duke.main()`. If the setup is correct, you should see something like the below: |
There was a problem hiding this comment.
Actual java filenames is conventionally the Java class name (just Duke). This could be a little complex.
| import java.util.Iterator; | ||
| import java.util.Scanner; | ||
|
|
||
| import static duke.FileManager.*; |
There was a problem hiding this comment.
Are there more specific classes from FileManager that you would be importing? It would be good to state them explicitly here.
| Task newTodo = new Todo(description.substring(1)); | ||
| taskList.add(newTodo); | ||
| writeToFile(initializeTextToWrite()); | ||
| printAddSuccessMessage(newTodo); |
There was a problem hiding this comment.
Here, there are two methods being used, except that steps to task creation and addition to task list are explicitly written. You could consider incorporating SLAP.
| throw new DukeException("Task does not exist"); | ||
| } | ||
| Task toBeDeleted = taskList.get(taskIndex); | ||
| // Some manipulation here |
There was a problem hiding this comment.
This comment is a little ambiguous. You could consider describing the below lines a little more. Alternatively, leaving it could be better.
| System.out.print(DIVLINE + GREETINGS + DIVLINE); | ||
| Scanner in = new Scanner(System.in); | ||
| while (!isExiting) { | ||
| try{ |
There was a problem hiding this comment.
Consider ensuring spaces before {, to make the layout more consistent.
| //create tasklist according to file storage | ||
| String[] arr = fileInput.get(i).split("\\|"); | ||
| switch (arr[0]) { | ||
| case "T": |
There was a problem hiding this comment.
Using a single alphabets to describe cases does not provide greater clarity on what cases the method is handling. You could see Using names to explain for alternatives.
Change deadline to recognize Date
Add Find Command
No description provided.