-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[karishma-t] iP #84
base: master
Are you sure you want to change the base?
[karishma-t] iP #84
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good
src/main/java/Ken.java
Outdated
|
||
//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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this variable name sound more like a boolean? for example: isDone
src/main/java/Ken.java
Outdated
System.out.println(" ____________________________________________________________"); | ||
|
||
|
||
// Check if the user wants to exit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on leaving comments with same indentation
src/main/java/Ken.java
Outdated
System.out.println(" Invalid input. Please provide a valid task number."); | ||
} | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this else be on the previous line? eg: } else {
src/main/java/Ken.java
Outdated
} else { | ||
System.out.println(" Task not found. Please provide a valid task number."); | ||
} | ||
} catch (NumberFormatException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on format of try-catch statements
src/main/java/Ken.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can break the code up into different functions for better readability
src/main/java/Ken.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can add some comments to make it easier to read and understand :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on the code!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
src/main/java/Ken.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/main/java/Ken.java
Outdated
String[] parts = userInput.split(" ", 2); | ||
if (parts.length != 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.