Skip to content

[karishma-t] iP#84

Open
karishma-t wants to merge 28 commits into
nus-cs2113-AY2324S1:masterfrom
karishma-t:master
Open

[karishma-t] iP#84
karishma-t wants to merge 28 commits into
nus-cs2113-AY2324S1:masterfrom
karishma-t:master

Conversation

@karishma-t

Copy link
Copy Markdown

No description provided.

@NeoMinWei NeoMinWei left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Very good

Comment thread 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

Copy link
Copy Markdown

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

Comment thread src/main/java/Ken.java Outdated
System.out.println(" ____________________________________________________________");


// Check if the user wants to exit

Copy link
Copy Markdown

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

Comment thread src/main/java/Ken.java Outdated
System.out.println(" Invalid input. Please provide a valid task number.");
}
}
else {

Copy link
Copy Markdown

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 {

Comment thread src/main/java/Ken.java Outdated
} else {
System.out.println(" Task not found. Please provide a valid task number.");
}
} catch (NumberFormatException e) {

Copy link
Copy Markdown

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 thread src/main/java/Ken.java Outdated
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) {

Copy link
Copy Markdown

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 thread src/main/java/Ken.java
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.");
}

Copy link
Copy Markdown

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

@Barbaracwx Barbaracwx left a comment

Copy link
Copy Markdown

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!

@YongbinWang YongbinWang left a comment

Copy link
Copy Markdown

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 thread src/main/java/Ken.java Outdated
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

Copy link
Copy Markdown

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 thread src/main/java/Ken.java Outdated
Comment on lines +59 to +60
String[] parts = userInput.split(" ", 2);
if (parts.length != 2) {

Copy link
Copy Markdown

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