[rohitcube] iP#86
Conversation
onx001
left a comment
There was a problem hiding this comment.
I like the naming conventions used, they were clear and concise. Any reason why you chose to omit javadocs and whitespaces?
| String logo = " ____ _ \n" | ||
| + "| _ \\ _ _| | _____ \n" | ||
| + "| | | | | | | |/ / _ \\\n" | ||
| + "| |_| | |_| | < __/\n" | ||
| + "|____/ \\__,_|_|\\_\\___|\n"; | ||
| String line = "------------------------"; | ||
|
|
||
| System.out.println(logo); | ||
| System.out.println("User"); | ||
| System.out.println("ToDos: tasks without any date/time attached to it e.g., visit new theme park"); | ||
| System.out.println("Deadlines: tasks that need to be done before a specific date/time e.g., submit report by 11/10/2019 5pm"); | ||
| System.out.println("Events: tasks that start at a specific date/time and ends at a specific date/time"); |
There was a problem hiding this comment.
Consider incorporating these lines with the logo to avoid repeating "System.out.println".
| String[] parts = userInput.split("/by"); | ||
| String description = parts[0].substring(9).trim(); | ||
| String by = parts[1].trim(); | ||
| tasks.add(new Deadline(description, by)); | ||
| System.out.println(line); | ||
| System.out.println("Got it. I've added this task:"); | ||
| System.out.println(" " + tasks.get(tasks.size() - 1)); | ||
| System.out.println("Now you have " + tasks.size() + " tasks in the list."); |
There was a problem hiding this comment.
Consider adding whitespaces to improve readability.
| System.out.println(logo); | ||
| System.out.println("User"); | ||
| System.out.println("ToDos: tasks without any date/time attached to it e.g., visit new theme park"); | ||
| System.out.println("Deadlines: tasks that need to be done before a specific date/time e.g., submit report by 11/10/2019 5pm"); |
There was a problem hiding this comment.
Consider splitting this line into shorter chunks.
| } else if (userInput.startsWith("unmark ")) { | ||
| int taskIndex = Integer.parseInt(userInput.split(" ")[1]) - 1; | ||
| if (taskIndex >= 0 && taskIndex < tasks.size()) { | ||
| tasks.get(taskIndex).markAsNotDone(); | ||
| System.out.println(line); | ||
| System.out.println("OK, I've marked this task as not done yet:"); | ||
| System.out.println(" " + tasks.get(taskIndex)); | ||
| } else { | ||
| System.out.println(line); | ||
| System.out.println("Invalid task index."); | ||
| } | ||
| } else { | ||
| tasks.add(new Todo(userInput)); | ||
| System.out.println(line); | ||
| System.out.println("added: " + userInput); | ||
| } | ||
|
|
| } else if (userInput.startsWith("mark ")) { | ||
| int taskIndex = Integer.parseInt(userInput.split(" ")[1]) - 1; | ||
| if (taskIndex >= 0 && taskIndex < tasks.size()) { | ||
| tasks.get(taskIndex).markAsDone(); | ||
| System.out.println(line); | ||
| System.out.println("Nice! I've marked this task as done:"); | ||
| System.out.println(" " + tasks.get(taskIndex)); | ||
| } else { | ||
| System.out.println(line); | ||
| System.out.println("Invalid task index."); |
There was a problem hiding this comment.
Try to avoid arrowhead style convention. Perhaps you could have the marking and unmarking of task as a separate method.
| } | ||
| } | ||
|
|
||
| class Task { |
There was a problem hiding this comment.
You should probably store the different classes in different files
| import java.util.Scanner; | ||
|
|
||
| public class Dukey { | ||
| public static void main(String[] args) { |
There was a problem hiding this comment.
Avoid long methods - could consider having different methods outside of the main method
YongbinWang
left a comment
There was a problem hiding this comment.
Overall good job so far. Some minor coding standard nitpicks from me. Good naming of variables and code quality. Keep up the good work!
| import Tasks.*; | ||
| import dukey.*; |
There was a problem hiding this comment.
Imported classes should always be listed explicitly.
| tasks.add(new Todo(description)); | ||
| tasks.get(tasks.size() - 1).printNewTask(); | ||
| } catch(IndexOutOfBoundsException e) { | ||
| System.out.println("_____________________________________________________"); |
There was a problem hiding this comment.
Consider abstracting this out into a constant variable called LINE_DIVIDER.
| public static void main(String[] args) { | ||
| System.out.println("Hey! I'm Dukey, your virtual assistant!\nWhat can I do for you?\n"); | ||
| Scanner in = new Scanner(System.in); | ||
| String line; |
There was a problem hiding this comment.
Consider changing the variable name to something more appropriate such as userInput.
| switch (firstWord) { | ||
| case "bye": |
There was a problem hiding this comment.
Take note of the coding standard violation here, the case clause should not have an indentation. You can change your IDE to follow the coding standard.
to add the delete feature to the main dukey branch
branch-Level-9
branch-A-JavaDoc
No description provided.