[karishma-t] iP#84
Conversation
|
|
||
| //Initialise array to store tasks | ||
| String[] tasks = new String[100]; | ||
| boolean[] taskStatus = new boolean[100]; // true for done, false for not done |
There was a problem hiding this comment.
Should this variable name sound more like a boolean? for example: isDone
| System.out.println(" ____________________________________________________________"); | ||
|
|
||
|
|
||
| // Check if the user wants to exit |
There was a problem hiding this comment.
Good job on leaving comments with same indentation
| System.out.println(" Invalid input. Please provide a valid task number."); | ||
| } | ||
| } | ||
| else { |
There was a problem hiding this comment.
Should this else be on the previous line? eg: } else {
| } else { | ||
| System.out.println(" Task not found. Please provide a valid task number."); | ||
| } | ||
| } catch (NumberFormatException e) { |
There was a problem hiding this comment.
Good job on format of try-catch statements
| if (userInput.equalsIgnoreCase("bye")) { | ||
| System.out.println("____________________________________________________________"); | ||
| System.out.println(" Bye then!"); | ||
| System.out.println("____________________________________________________________"); | ||
| break; // Exit the loop | ||
| } else if (userInput.equalsIgnoreCase("list")) { | ||
| System.out.println(" Tasks "); | ||
| for (int i = 0; i < taskCount; i++) { | ||
| char statusSymbol = taskStatus[i] ? 'X' : ' '; | ||
| System.out.println(" " + (i + 1) + ".[" + statusSymbol + "] " + tasks[i]); } | ||
| } else if (userInput.startsWith("mark " )) { | ||
| try { | ||
| int taskIndex = Integer.parseInt(userInput.substring(5).trim()) - 1; | ||
| if (taskIndex >= 0 && taskIndex < taskCount) { |
There was a problem hiding this comment.
maybe you can break the code up into different functions for better readability
| try { | ||
| int taskIndex = Integer.parseInt(userInput.substring(7).trim()) - 1; | ||
| if (taskIndex >= 0 && taskIndex < taskCount) { | ||
| taskStatus[taskIndex] = false; | ||
| System.out.println(" OK, I've marked this task as not done yet:"); | ||
| System.out.println(" [ ] " + tasks[taskIndex]); | ||
| } else { | ||
| System.out.println(" Task not found. Please provide a valid task number."); | ||
| } |
There was a problem hiding this comment.
maybe you can add some comments to make it easier to read and understand :)
YongbinWang
left a comment
There was a problem hiding this comment.
Overall good effort so far. Take note to practice object oriented programming concepts such as inheritance and polymorphism. Slowly start to change your ip in that direction so that you do not rush at the last minute. Keep up the good work!
| private static String[] taskDescriptions = new String[100]; | ||
| private static boolean[] taskDoneStatus = new boolean[100]; // true for done, false for not done | ||
| private static String[] taskTypes = new String[100]; // "T" for ToDo, "D" for Deadline, "E" for Event | ||
| private static String[] taskDates = new String[100]; // Store date/time information |
There was a problem hiding this comment.
Consider creating java classes such as Task, Todo, Deadline, Event and use the concepts learnt in lecture such as inheritance and polymorphism to structure your program.
| String[] parts = userInput.split(" ", 2); | ||
| if (parts.length != 2) { |
There was a problem hiding this comment.
Try to avoid magic literals, you can consider creating a constant for the integer 2.
Branch level 9
Add feature summary to readme
No description provided.