Skip to content

[Ayushi Yadav] iP#125

Open
ayushi0803 wants to merge 38 commits into
nus-cs2113-AY2425S1:masterfrom
ayushi0803:master
Open

[Ayushi Yadav] iP#125
ayushi0803 wants to merge 38 commits into
nus-cs2113-AY2425S1:masterfrom
ayushi0803:master

Conversation

@ayushi0803

Copy link
Copy Markdown

No description provided.

In this commit, if a user enters a command then the system echos the commands back. The user can also add anything to the list and store it, and view the list. Upon finishing a task, it can be marked as done, and vice versa. The Intellij Java Google Style coding standard has been implemented
…todo, event or deadline and mark or unmark either of the aforementioned off their list. They can aso view their list along with the task completion status.
* branch-Level-5:
  this commit adds all my current work to github again
…ou want to delete any item in the list then you can enter the delete command to amend the list respectively.
* branch-Level-6:
  level 6 commit that has additional spaces to test branching
…nputs change based on whatever the user enters. the Duke file consists of the ameded code to include the save feature
…riate error messages as and when needed. this helps in making the code more robust and user friendly
… rectify the branching - the previous commit enabled the code to deal with errors
Comment thread src/main/java/Duke.java Outdated
} else {
handleAddCommand(input);
}
} catch (DukeException 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.

Is the variable name "e" informative enough?

Comment thread src/main/java/Duke.java Outdated
FileWriter writer = new FileWriter(FILE_PATH);
for (int i = 0; i < taskCount; i++) {
Task task = tasks[i];
writer.write("T | " + (task.isDone ? "1" : "0") + " | " + task.description + "\n");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Would be good to assign magic strings to a named constant instead

Comment thread src/main/java/Duke.java Outdated
Comment on lines +11 to +61
public static void main(String[] args) {
// Print the welcome message
System.out.println("____________________________________________________________");
System.out.println(" Hello! I'm Ruhi.");
System.out.println(" What can I do for you?");
System.out.println("____________________________________________________________");

// Load existing tasks from file
loadTasksFromFile();

// Initialize a scanner to read user input
Scanner scanner = new Scanner(System.in);

while (true) {
try {
String input = scanner.nextLine();
System.out.println("____________________________________________________________");

if (input.equals("bye")) {
System.out.println(" Bye. Hope to see you again soon!");
System.out.println("____________________________________________________________");
break;
} else if (input.equals("list")) {
// Display the list of tasks
System.out.println(" Here are the tasks in your list:");
for (int i = 0; i < taskCount; i++) {
System.out.println((i + 1) + "." + tasks[i]);
}
System.out.println("____________________________________________________________");
} else if (input.startsWith("mark")) {
handleMarkCommand(input);
} else if (input.startsWith("unmark")) {
handleUnmarkCommand(input);
} else if (input.startsWith("delete")) {
handleDeleteCommand(input);
} else if (input.trim().isEmpty()) {
throw new DukeException("Oops! Task description cannot be empty.");
} else {
handleAddCommand(input);
}
} catch (DukeException e) {
System.out.println(e.getMessage());
System.out.println("____________________________________________________________");
} catch (Exception e) {
System.out.println("Oopsy daisy! Something went wrong, check again.");
System.out.println("____________________________________________________________");
}
}

scanner.close();
}

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 extracting parts of the code the a separate method to avoid having long methods

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.

3 participants