Skip to content
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

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open

Conversation

karishma-t
Copy link

No description provided.

Copy link

@NeoMinWei NeoMinWei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good


//Initialise array to store tasks
String[] tasks = new String[100];
boolean[] taskStatus = new boolean[100]; // true for done, false for not done

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

System.out.println(" ____________________________________________________________");


// Check if the user wants to exit

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

System.out.println(" Invalid input. Please provide a valid task number.");
}
}
else {

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 {

} else {
System.out.println(" Task not found. Please provide a valid task number.");
}
} catch (NumberFormatException e) {

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

Comment on lines 28 to 41
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) {

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

Comment on lines 52 to 60
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.");
}

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 :)

Copy link

@Barbaracwx Barbaracwx left a 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!

Copy link

@YongbinWang YongbinWang left a 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!

Comment on lines 5 to 8
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

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.

Comment on lines 59 to 60
String[] parts = userInput.split(" ", 2);
if (parts.length != 2) {

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants