diff --git a/data/taskList.txt b/data/taskList.txt index 2e7aee6981..1bb2e746f4 100644 --- a/data/taskList.txt +++ b/data/taskList.txt @@ -1,4 +1,3 @@ -T | 0 | read book -D | 0 | return book | 2022-09-20 -T | 0 | gym -T | 0 | code +T | 0 | read +D | 0 | return book | 2022-10-10 +D | 0 | return book | 2022-10-10 diff --git a/docs/README.md b/docs/README.md index 8077118ebe..1b28f694c7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,29 +1,115 @@ -# User Guide +# User Guide for JARVIS -## Features +### 1. Adding tasks -### Feature-ABC +Description: Adds a task. There are 3 different types of tasks you can add: Todo, Deadline and Events. -Description of the feature. +#### - Add a Todo -### Feature-XYZ +Command: `todo {task}` -Description of the feature. +Example: `todo read book` -## Usage +Expected outcome: +``` +Got it. I've added this task: +[T][] read book +Now you have 1 tasks in the list. +``` + +#### - Add a Deadline + +Command: `deadline {task} /by date in yyyy-mm-dd format` + +Example: `deadline return book /by 2022-10-10` + +Expected outcome: +``` +Got it. I've added this task: +[D][] return book (by: Oct 10 2022) +Now you have 2 tasks in the list. +``` + +#### - Add an Event + +Command: `event {task} /at date in yyyy-mm-dd format` -### `Keyword` - Describe action +Example: `event project meeting /at 2022-10-10` -Describe the action and its outcome. +Expected outcome: +``` +Got it. I've added this task: +[E][] project meeting (at: Oct 10 2022) +Now you have 3 tasks in the list. +``` -Example of usage: +### 2. Deleting tasks -`keyword (optional arguments)` +Description: Deletes a task at the input task number + +Command: `delete {task number}` + +Example: `delete 1` Expected outcome: +``` +Noted. I've removed this task: +[T][] read +Now you have 2 tasks in the list. +``` + +### 3. Listing your tasks + +Description: Lists out all the tasks in the task list. -Description of the outcome. +Command: `list` +Expected outcome: +``` +Here are the tasks in your task list: +1.[D][] return book (by: Oct 10 2022) +2.[E][] project meeting (at: Oct 10 2022) +``` + +### 4. Marking your tasks as done + +Description: Marks the task of the input task number as done. + +Command: `mark {task number}` + +Example: `mark 1` + +Expected outcome: +``` +Great! I've marked this task as done: +[D][X]return book (by: Oct 10 2022) +``` + + +### 5. Unmarking your tasks + +Description: Unmarks the task of the input task number as not done. + +Command: `unmark {task number}` + +Example: `unmark 1` + +Expected outcome: +``` +Ok, I have marked this task as not done yet: +[D][]return book (by: Oct 10 2022) +``` + +### 6. Finding tasks + +Description: Finds all the task that contains the keyword and list them out. + +Command: `find {keyword}` + +Example: `find book` + +Expected outcome: ``` -expected output +Here are the matching tasks in your list: +1.[D][]return book (by: Oct 10 2022) ``` diff --git a/src/main/java/jarvis/Parser.java b/src/main/java/jarvis/Parser.java index 64c24bd860..fe2e023036 100644 --- a/src/main/java/jarvis/Parser.java +++ b/src/main/java/jarvis/Parser.java @@ -125,6 +125,8 @@ private static String handleDelete(TaskList tasks, String input) { tasks.getList().remove(toDelete); String deleteResponse = "Noted. I have removed this task:\n "; String output = deleteResponse + deleteTask.toString(); + Task.minusCount(); + output = output + "\nNow you have " + Task.getCount() + " tasks in the list."; return output; } @@ -134,8 +136,8 @@ private static String handleToDo(TaskList tasks, String input) throws JarvisExce throw new JarvisException("The description of a todo cannot be empty"); } tasks.getList().add(new ToDo(description)); - String output = ("Got it. I've added this task:\n " + tasks.getList().get(Task.getCount() - 1) - + "\nNow you have " + (Task.getCount()) + " tasks in the list."); + String output = ("Got it. I've added this task:\n " + tasks.getList().get(tasks.getList().size() - 1) + + "\nNow you have " + (tasks.getList().size()) + " tasks in the list."); return output; } @@ -144,8 +146,8 @@ private static String handleDeadline(TaskList tasks, String input) { String description = input.substring(9, divisor - 1); String date = input.substring(divisor + 4); tasks.getList().add(new Deadline(description, date)); - String output = ("Got it. I've added this task:\n " + tasks.getList().get(Task.getCount() - 1) - + "\nNow you have " + (Task.getCount()) + " tasks in the list."); + String output = ("Got it. I've added this task:\n " + tasks.getList().get(tasks.getList().size() - 1) + + "\nNow you have " + (tasks.getList().size()) + " tasks in the list."); return output; } @@ -154,8 +156,8 @@ private static String handleEvent(TaskList tasks, String input) { String description = input.substring(6, divisor - 1); String date = input.substring(divisor + 4); tasks.getList().add(new Event(description, date)); - String output = ("Got it. I've added this task:\n " + tasks.getList().get(Task.getCount() - 1) - + "\nNow you have " + (Task.getCount()) + " tasks in the list."); + String output = ("Got it. I've added this task:\n " + tasks.getList().get(tasks.getList().size() - 1) + + "\nNow you have " + (tasks.getList().size()) + " tasks in the list."); return output; } diff --git a/src/main/java/jarvis/task/Task.java b/src/main/java/jarvis/task/Task.java index a1403598bf..b383baeeea 100644 --- a/src/main/java/jarvis/task/Task.java +++ b/src/main/java/jarvis/task/Task.java @@ -61,4 +61,8 @@ public boolean getDone() { public static int getCount() { return count; } + + public static void minusCount() { + count--; + } }