diff --git a/docs/README.md b/docs/README.md
index 8077118eb..5c1c55693 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -2,28 +2,181 @@
## Features
-### Feature-ABC
+### 1. Add tasks
-Description of the feature.
+ Add three types of tasks to the list (todo, deadline,event)
-### Feature-XYZ
+### 2. List tasks
+
+ Display all the tasks in the list
+
+### 3. Delete task
+ Delete a task from the list with a given index
+
+### 4. Mark task as done
+ Mark a task as done with a given index
+
+### 5. Find task
+ Find a task in the list with a given key word
+
+### 6. clear all the tasks
+ Clear all the tasks in the list
-Description of the feature.
## Usage
-### `Keyword` - Describe action
+### 1. `todo` - add a simple task to the list
-Describe the action and its outcome.
+Format: `todo DESCRIPTION`
Example of usage:
-`keyword (optional arguments)`
+`todo do the online quiz`
+
+Expected outcome:
+
+```
+Got it. I have added the task to your list.
+[T][ ] do the online quiz
+```
+
+You have added the task to the list successfully.
+
+### 2. `deadline` - add a deadline to the list
+
+Format: `deadline DESCRIPTION /by TIME`
+
+Example of usage:
+
+`deadline submit individual project /by 1 Oct 23:59`
+
+Expected outcome:
+
+```
+Got it. I have added the task to your list.
+[D][ ] submit individual project (by: 1 Oct 23:59)
+```
+
+You have added the deadline to the list successfully.
+
+### 3. `event` - add a event to the list
+
+Format: `event DESCRIPTION /at TIME`
+
+Example of usage:
+
+`event online programming workshop /at Tuesday`
+
+Expected outcome:
+
+```
+Got it. I have added the task to your list.
+[E][ ] online programming workshop (by: Tuesday)
+```
+
+You have added the event to the list successfully.
+
+### 4. `list` - list all the tasks
+
+Format: `list`
+
+Expected outcome:
+
+```
+Here are the tasks in your list:
+1. [T][ ] read books
+2. [E][X] online meeting (at: 30 Sept 22:00)
+```
+
+### 5. `done` - mark a task as done
+
+Format: `done TARGET_INDEX`
+
+Example of usage:
+
+`done 1`
Expected outcome:
-Description of the outcome.
+```
+Nice, I have marked this task as done:
+[T][X] read books
+```
+The first task in the list has been marked as done
+
+### 6. `delete` - delete a task from the list
+
+Format: `delete TARGET_INDEX`
+
+Example of usage:
+
+`delete 2`
+
+Expected outcome:
+
+```
+Got it. I have deleted the tasks in your list!
+[E][X] online meeting (at: 30 Sept 22:00)
+```
+The second task in the list has been deleted
+
+### 7. `clear` - clear all the tasks
+
+Format: `clear`
+
+Expected outcome:
+
+```
+The tasks in your list have been cleared.
+```
+The list is empty now
+
+### 8. `find` - find a task containing the given key word(s)
+
+Format: `find TARGET`
+
+Example of usage:
+
+`find read`
+
+Expected outcome:
```
-expected output
+Here are the matching tasks in your list:
+[T][ ] read books
+[D][X] read lab manual (by: today 22:00)
```
+All the tasks containing the key word have been displayed
+
+### 9. `help` - show help information
+
+Format: `help`
+
+Expected outcome:
+
+```
+Here are the usage of all commands:
+
+deadline: add a deadline task to the current list.
+ Parameters: DESCRIPTION, BY_TIME
+ Example: deadline take the quiz /by Tuesday
+
+...(omitted)
+
+list: display all tasks in the current list.
+ Example: list
+```
+The usages of all commands have been displayed
+
+### 10. `bye` - exit the program
+
+Format: `bye`
+
+Expected outcome:
+
+```
+Bye. Hope to see you soon~
+```
+The program have been terminated, and the changes in each step have been saved, so you can
+load the task list record when you start the program next time : )
+
diff --git a/src/main/java/.idea/.gitignore b/src/main/java/.idea/.gitignore
new file mode 100644
index 000000000..73f69e095
--- /dev/null
+++ b/src/main/java/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/src/main/java/.idea/artifacts/main_jar.xml b/src/main/java/.idea/artifacts/main_jar.xml
new file mode 100644
index 000000000..161508e49
--- /dev/null
+++ b/src/main/java/.idea/artifacts/main_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/main_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/.idea/misc.xml b/src/main/java/.idea/misc.xml
new file mode 100644
index 000000000..6dbc0d28c
--- /dev/null
+++ b/src/main/java/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/.idea/modules.xml b/src/main/java/.idea/modules.xml
new file mode 100644
index 000000000..122a9054e
--- /dev/null
+++ b/src/main/java/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/.idea/runConfigurations.xml b/src/main/java/.idea/runConfigurations.xml
new file mode 100644
index 000000000..797acea53
--- /dev/null
+++ b/src/main/java/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/.idea/vcs.xml b/src/main/java/.idea/vcs.xml
new file mode 100644
index 000000000..c2365ab11
--- /dev/null
+++ b/src/main/java/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/Deadline.java b/src/main/java/Deadline.java
new file mode 100644
index 000000000..a4a2c1c0d
--- /dev/null
+++ b/src/main/java/Deadline.java
@@ -0,0 +1,14 @@
+public class Deadline extends Task {
+ public String by;
+
+ public Deadline(String description, String by) {
+ super(description);
+ this.by = by;
+ }
+
+ @Override
+ public String toString() {
+ return "[D]" + super.toString() + "(by: " + this.by
+ + ")";
+ }
+}
diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java
index 5d313334c..eb710bb42 100644
--- a/src/main/java/Duke.java
+++ b/src/main/java/Duke.java
@@ -1,10 +1,49 @@
+package Duke;
+
+import Duke.Parser.Parser;
+import Duke.DukeException.DukeException;
+import Duke.Command.*;
+import Duke.Storage.Storage;
+import Duke.Ui.Ui;
+import Duke.Tasks.TaskList;
+
public class Duke {
+ private Storage storage;
+ private TaskList tasks;
+ private Ui ui;
+
+ public Duke(String filePath) {
+ ui = new Ui();
+ storage = new Storage(filePath);
+ try {
+ tasks = new TaskList(storage.load());
+ } catch (DukeException e) {
+ ui.showLoadingError();
+ tasks = new TaskList();
+ }
+ }
+ /**
+ * Run the program.
+ */
+ public void run() {
+ ui.showWelcome();
+ boolean isExit = false;
+ while (!isExit) {
+ try {
+ String fullCommand = ui.readCommand();
+ ui.showLine();
+ Command c = Parser.parse(fullCommand);
+ c.execute(tasks, ui, storage);
+ isExit = c.isExit();
+ } catch (DukeException e) {
+ ui.showError(e.getMessage());
+ } finally {
+ ui.showLine();
+ }
+ }
+ }
+
public static void main(String[] args) {
- String logo = " ____ _ \n"
- + "| _ \\ _ _| | _____ \n"
- + "| | | | | | | |/ / _ \\\n"
- + "| |_| | |_| | < __/\n"
- + "|____/ \\__,_|_|\\_\\___|\n";
- System.out.println("Hello from\n" + logo);
+ new Duke(".\\tasks.txt").run();
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/Duke/Command/AddDeadlineCommand.java b/src/main/java/Duke/Command/AddDeadlineCommand.java
new file mode 100644
index 000000000..c3b2d4790
--- /dev/null
+++ b/src/main/java/Duke/Command/AddDeadlineCommand.java
@@ -0,0 +1,37 @@
+package Duke.Command;
+
+import Duke.Ui.Ui;
+import Duke.Storage.Storage;
+import Duke.Tasks.Deadline;
+import Duke.Tasks.TaskList;
+
+public class AddDeadlineCommand extends Command {
+ private final String description;
+ private final String by;
+
+ public static final String COMMAND_WORD = "deadline";
+ public static final String COMMAND_DESCRIPTION = COMMAND_WORD
+ + ": add a deadline task to the current list.\n"
+ + " Parameters: DESCRIPTION, BY_TIME\n"
+ + " Example: " + COMMAND_WORD + " take the quiz /by Tuesday";
+
+ public AddDeadlineCommand(String description, String by) {
+ this.description = description;
+ this.by = by;
+ }
+
+ /**
+ * Execute the add deadline command by adding a new deadline task to TaskList
+ *
+ * @param tasks TaskList the command to be executed on
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on
+ */
+ @Override
+ public void execute(TaskList tasks, Ui ui, Storage storage) {
+ ui.printAddTaskMessage(new Deadline(this.description, this.by));
+ tasks.addDeadline(this.description, this.by);
+ ui.printNumOfTasks(tasks);
+ storage.save(tasks.getTasks());
+ }
+}
diff --git a/src/main/java/Duke/Command/AddEventCommand.java b/src/main/java/Duke/Command/AddEventCommand.java
new file mode 100644
index 000000000..67f8d1353
--- /dev/null
+++ b/src/main/java/Duke/Command/AddEventCommand.java
@@ -0,0 +1,37 @@
+package Duke.Command;
+
+import Duke.Ui.Ui;
+import Duke.Storage.Storage;
+import Duke.Tasks.Event;
+import Duke.Tasks.TaskList;
+
+public class AddEventCommand extends Command {
+ private final String description;
+ private final String at;
+
+ public static final String COMMAND_WORD = "event";
+ public static final String COMMAND_DESCRIPTION = COMMAND_WORD
+ + ": add an event task to the current list.\n"
+ + " Parameters: DESCRIPTION, AT_TIME\n"
+ + " Example: " + COMMAND_WORD + "attend CS2113 lecture /at Dec 4";
+
+ /**
+ * Execute the add event command by adding a new event task to TaskList
+ *
+ * @param tasks TaskList the command to be executed on
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on
+ */
+ public AddEventCommand(String description, String at) {
+ this.description = description;
+ this.at = at;
+ }
+
+ @Override
+ public void execute(TaskList tasks, Ui ui, Storage storage) {
+ ui.printAddTaskMessage(new Event(this.description, this.at));
+ tasks.addEvent(this.description, this.at);
+ ui.printNumOfTasks(tasks);
+ storage.save(tasks.getTasks());
+ }
+}
diff --git a/src/main/java/Duke/Command/AddTodoCommand.java b/src/main/java/Duke/Command/AddTodoCommand.java
new file mode 100644
index 000000000..896c04de6
--- /dev/null
+++ b/src/main/java/Duke/Command/AddTodoCommand.java
@@ -0,0 +1,35 @@
+package Duke.Command;
+
+import Duke.Ui.Ui;
+import Duke.Storage.Storage;
+import Duke.Tasks.Todo;
+import Duke.Tasks.TaskList;
+
+public class AddTodoCommand extends Command {
+ private final String description;
+
+ public static final String COMMAND_WORD = "todo";
+ public static final String COMMAND_DESCRIPTION = COMMAND_WORD
+ + ": add a todo task to the current list.\n"
+ + " Parameters: DESCRIPTION\n"
+ + " Example: " + COMMAND_WORD + " complete the assessment";
+
+ public AddTodoCommand(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Execute the add todo command by adding a new todo task to TaskList
+ *
+ * @param tasks TaskList the command to be executed on
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on
+ */
+ @Override
+ public void execute(TaskList tasks, Ui ui, Storage storage) {
+ ui.printAddTaskMessage(new Todo(this.description));
+ tasks.addTodo(this.description);
+ ui.printNumOfTasks(tasks);
+ storage.save(tasks.getTasks());
+ }
+}
diff --git a/src/main/java/Duke/Command/ClearCommand.java b/src/main/java/Duke/Command/ClearCommand.java
new file mode 100644
index 000000000..b6e915607
--- /dev/null
+++ b/src/main/java/Duke/Command/ClearCommand.java
@@ -0,0 +1,26 @@
+package Duke.Command;
+
+import Duke.Ui.Ui;
+import Duke.Storage.Storage;
+import Duke.Tasks.TaskList;
+
+public class ClearCommand extends Command {
+ public static final String COMMAND_WORD = "clear";
+ public static final String COMMAND_DESCRIPTION = COMMAND_WORD
+ + ": clear all tasks in the current list.\n"
+ + " Example: " + COMMAND_WORD;
+
+ /**
+ * Execute the clear command by clearing the tasks in TaskList
+ *
+ * @param tasks TaskList the command to be executed on
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on
+ */
+ @Override
+ public void execute(TaskList tasks, Ui ui, Storage storage) {
+ ui.printClearMessage();
+ tasks.clearTasks();
+ storage.save(tasks.getTasks());
+ }
+}
diff --git a/src/main/java/Duke/Command/Command.java b/src/main/java/Duke/Command/Command.java
new file mode 100644
index 000000000..a4ea0c12a
--- /dev/null
+++ b/src/main/java/Duke/Command/Command.java
@@ -0,0 +1,14 @@
+package Duke.Command;
+
+import Duke.Storage.Storage;
+import Duke.Ui.Ui;
+import Duke.DukeException.DukeException;
+import Duke.Tasks.TaskList;
+
+public abstract class Command {
+ public abstract void execute(TaskList tasks, Ui ui, Storage storage) throws DukeException;
+
+ public boolean isExit() {
+ return false;
+ }
+}
diff --git a/src/main/java/Duke/Command/DeleteCommand.java b/src/main/java/Duke/Command/DeleteCommand.java
new file mode 100644
index 000000000..3dec696ea
--- /dev/null
+++ b/src/main/java/Duke/Command/DeleteCommand.java
@@ -0,0 +1,35 @@
+package Duke.Command;
+
+import Duke.Storage.Storage;
+import Duke.Ui.Ui;
+import Duke.DukeException.DukeException;
+import Duke.Tasks.TaskList;
+
+public class DeleteCommand extends Command {
+ public static final String COMMAND_WORD = "delete";
+
+ public static final String COMMAND_DESCRIPTION = COMMAND_WORD
+ + ": Delete the task identified by the index number used in the current list.\n"
+ + " Parameters: INDEX\n"
+ + " Example: " + COMMAND_WORD + " 1";
+
+ private final int index;
+
+ public DeleteCommand(int index) {
+ this.index = index;
+ }
+
+ /**
+ * Execute the delete command by deleting a task from TaskList
+ *
+ * @param tasks TaskList the command to be executed on
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on
+ */
+ @Override
+ public void execute(TaskList tasks, Ui ui, Storage storage) throws DukeException {
+ ui.printDeleteMessage(tasks.deleteTask(this.index));
+ ui.printNumOfTasks(tasks);
+ storage.save(tasks.getTasks());
+ }
+}
diff --git a/src/main/java/Duke/Command/DoneCommand.java b/src/main/java/Duke/Command/DoneCommand.java
new file mode 100644
index 000000000..967b36ae3
--- /dev/null
+++ b/src/main/java/Duke/Command/DoneCommand.java
@@ -0,0 +1,32 @@
+package Duke.Command;
+
+import Duke.Storage.Storage;
+import Duke.Ui.Ui;
+import Duke.DukeException.DukeException;
+import Duke.Tasks.TaskList;
+
+public class DoneCommand extends Command {
+ private final int index;
+ public static final String COMMAND_WORD = "done";
+ public static final String COMMAND_DESCRIPTION = COMMAND_WORD
+ + ": mark a task in the list as done.\n"
+ + " Parameters: INDEX\n"
+ + " Example: " + COMMAND_WORD + " 1";
+
+ public DoneCommand(int index) {
+ this.index = index;
+ }
+
+ /**
+ * Execute the done command by setting a task as done and showing it
+ *
+ * @param tasks TaskList the command to be executed on
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on
+ */
+ @Override
+ public void execute(TaskList tasks, Ui ui, Storage storage) throws DukeException {
+ ui.printDoneMessage(tasks.setDone(this.index));
+ storage.save(tasks.getTasks());
+ }
+}
diff --git a/src/main/java/Duke/Command/ExitCommand.java b/src/main/java/Duke/Command/ExitCommand.java
new file mode 100644
index 000000000..015740fb7
--- /dev/null
+++ b/src/main/java/Duke/Command/ExitCommand.java
@@ -0,0 +1,34 @@
+package Duke.Command;
+
+import Duke.Storage.Storage;
+import Duke.Ui.Ui;
+import Duke.Tasks.TaskList;
+
+public class ExitCommand extends Command {
+ public static final String COMMAND_WORD = "bye";
+ public static final String COMMAND_DESCRIPTION = COMMAND_WORD
+ + ": exit the programme.\n"
+ + " Example: " + COMMAND_WORD;
+
+ @Override
+ /**
+ * Execute the exit command by showing the closing messagee
+ *
+ * @param tasks TaskList the command to be executed on
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on
+ */
+ public void execute(TaskList tasks, Ui ui, Storage storage) {
+ ui.showByeMessage();
+ }
+
+ /**
+ * Set the flag isExit to true to terminate the program
+ *
+ * @return boolean Flag IsExit set to be true
+ */
+ @Override
+ public boolean isExit() {
+ return true;
+ }
+}
diff --git a/src/main/java/Duke/Command/FindCommand.java b/src/main/java/Duke/Command/FindCommand.java
new file mode 100644
index 000000000..4d111ec54
--- /dev/null
+++ b/src/main/java/Duke/Command/FindCommand.java
@@ -0,0 +1,40 @@
+package Duke.Command;
+
+import Duke.Storage.Storage;
+import Duke.Ui.Ui;
+import Duke.Tasks.Task;
+import Duke.Tasks.TaskList;
+
+public class FindCommand extends Command {
+ public static final String COMMAND_WORD = "find";
+
+ public static final String COMMAND_DESCRIPTION = COMMAND_WORD
+ + ": find a task in the list by key word.\n"
+ + " Parameters: DESCRIPTION\n"
+ + " Example: " + COMMAND_WORD + " read";
+
+ private final String target;
+
+ /**
+ * Executes the find command by looking for and showing tasks in TaskList that contain the key word
+ *
+ * @param tasks TaskList the command to be executed on
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on
+ */
+ public FindCommand(String target) {
+ this.target = target;
+ }
+
+ @Override
+ public void execute(TaskList tasks, Ui ui, Storage storage) {
+ if (tasks.find(this.target).size() == 0) {
+ ui.printNoMatchingTaskMessage();
+ } else {
+ ui.printFindMessage();
+ for (Task task : tasks.find(this.target)) {
+ System.out.println(task.toString());
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/Duke/Command/HelpCommand.java b/src/main/java/Duke/Command/HelpCommand.java
new file mode 100644
index 000000000..b49021c82
--- /dev/null
+++ b/src/main/java/Duke/Command/HelpCommand.java
@@ -0,0 +1,24 @@
+package Duke.Command;
+
+import Duke.Storage.Storage;
+import Duke.Ui.Ui;
+import Duke.Tasks.TaskList;
+
+public class HelpCommand extends Command {
+ public static final String COMMAND_WORD = "help";
+ public static final String COMMAND_DESCRIPTION = COMMAND_WORD
+ + ": show help message for the programme.\n"
+ + " Example: " + COMMAND_WORD;
+
+ /**
+ * Execute the help command by showing the usage of all the commands
+ *
+ * @param tasks TaskList the command to be executed on
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on
+ */
+ @Override
+ public void execute(TaskList tasks, Ui ui, Storage storage) {
+ ui.showHelpMessage();
+ }
+}
diff --git a/src/main/java/Duke/Command/InvalidCommand.java b/src/main/java/Duke/Command/InvalidCommand.java
new file mode 100644
index 000000000..72b6e6fb0
--- /dev/null
+++ b/src/main/java/Duke/Command/InvalidCommand.java
@@ -0,0 +1,23 @@
+package Duke.Command;
+
+import Duke.Storage.Storage;
+import Duke.Ui.Ui;
+import Duke.Tasks.TaskList;
+
+public class InvalidCommand extends Command {
+ public InvalidCommand() {
+
+ }
+
+ @Override
+ /**
+ * Execute the invalid command by showing invalid command message
+ *
+ * @param tasks TaskList the command to be executed on
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on
+ */
+ public void execute(TaskList tasks, Ui ui, Storage storage) {
+ ui.printInvalidCommandMessage();
+ }
+}
diff --git a/src/main/java/Duke/Command/ListCommand.java b/src/main/java/Duke/Command/ListCommand.java
new file mode 100644
index 000000000..05fbb6b0e
--- /dev/null
+++ b/src/main/java/Duke/Command/ListCommand.java
@@ -0,0 +1,29 @@
+package Duke.Command;
+
+import Duke.Ui.Ui;
+import Duke.Storage.Storage;
+import Duke.Tasks.TaskList;
+
+public class ListCommand extends Command {
+ public static final String COMMAND_WORD = "list";
+ public static final String COMMAND_DESCRIPTION = COMMAND_WORD
+ + ": display all tasks in the current list.\n"
+ + " Example: " + COMMAND_WORD;
+
+ /**
+ * Execute the list command by showing the TaskList.
+ *
+ * @param tasks TaskList the command to be executed on.
+ * @param ui Ui used for execution
+ * @param storage Storage which the command may make change on.
+ */
+ @Override
+ public void execute(TaskList tasks, Ui ui, Storage storage) {
+ if (!tasks.isEmpty()) {
+ ui.printListMessage();
+ tasks.printTasks();
+ } else {
+ ui.printListEmptyMessage();
+ }
+ }
+}
diff --git a/src/main/java/Duke/Duke.java b/src/main/java/Duke/Duke.java
new file mode 100644
index 000000000..d29b52605
--- /dev/null
+++ b/src/main/java/Duke/Duke.java
@@ -0,0 +1,47 @@
+package Duke;
+
+import Duke.Parser.Parser;
+import Duke.DukeException.DukeException;
+import Duke.Command.*;
+import Duke.Storage.Storage;
+import Duke.Tasks.TaskList;
+import Duke.Ui.Ui;
+
+public class Duke {
+ private Storage storage;
+ private TaskList tasks;
+ private Ui ui;
+
+ public Duke(String filePath) {
+ ui = new Ui();
+ storage = new Storage(filePath);
+ try {
+ tasks = new TaskList(storage.load());
+ } catch (DukeException e) {
+ ui.showLoadingError();
+ tasks = new TaskList();
+ }
+ }
+
+ public void run() {
+ ui.showWelcome();
+ boolean isExit = false;
+ while (!isExit) {
+ try {
+ String fullCommand = ui.readCommand();
+ ui.showLine();
+ Command c = Parser.parse(fullCommand);
+ c.execute(tasks, ui, storage);
+ isExit = c.isExit();
+ } catch (DukeException e) {
+ ui.showError(e.getMessage());
+ } finally {
+ ui.showLine();
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ new Duke(".\\tasks.txt").run();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/Duke/DukeException/DukeException.java b/src/main/java/Duke/DukeException/DukeException.java
new file mode 100644
index 000000000..fb231e2e8
--- /dev/null
+++ b/src/main/java/Duke/DukeException/DukeException.java
@@ -0,0 +1,14 @@
+package Duke.DukeException;
+
+public class DukeException extends Exception {
+ private final String message;
+
+ public DukeException(String message) {
+ super(message);
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+}
diff --git a/src/main/java/Duke/DukeException/IndexMissingException.java b/src/main/java/Duke/DukeException/IndexMissingException.java
new file mode 100644
index 000000000..03c971b97
--- /dev/null
+++ b/src/main/java/Duke/DukeException/IndexMissingException.java
@@ -0,0 +1,12 @@
+package Duke.DukeException;
+
+public class IndexMissingException extends Exception {
+ public static final String line = "____________________________________________________________\n";
+ public static final String message = line
+ + "Please tell me the index for the operation.:-(\n"
+ + line;
+
+ public final void printMessage() {
+ System.out.println(this.message);
+ }
+}
diff --git a/src/main/java/Duke/DukeException/InvalidCommandException.java b/src/main/java/Duke/DukeException/InvalidCommandException.java
new file mode 100644
index 000000000..8b5a2802d
--- /dev/null
+++ b/src/main/java/Duke/DukeException/InvalidCommandException.java
@@ -0,0 +1,12 @@
+package Duke.DukeException;
+
+public class InvalidCommandException extends Exception {
+ public static final String line = "____________________________________________________________\n";
+ public static final String message = line
+ + "OOPS!!! I'm sorry, but I don't know what that means :-(\n"
+ + "Please give me a valid command.\n" + line;
+
+ public final void printMessage() {
+ System.out.println(this.message);
+ }
+}
diff --git a/src/main/java/Duke/Parser/Parser.java b/src/main/java/Duke/Parser/Parser.java
new file mode 100644
index 000000000..254d177e7
--- /dev/null
+++ b/src/main/java/Duke/Parser/Parser.java
@@ -0,0 +1,187 @@
+package Duke.Parser;
+
+import Duke.Command.*;
+import Duke.DukeException.DukeException;
+
+public class Parser {
+ public static final int TODO_POS = 5;
+ public static final int BY_POS = 4;
+ public static final int DEADLINE_POS = 9;
+ public static final int AT_POS = 4;
+ public static final int EVENT_POS = 6;
+ public static final int FIND_POS = 5;
+
+ public Parser() {
+ }
+
+ /**
+ * Parses the input and get the command with required variables
+ *
+ * @param input Input string from the user
+ * @return Command Command class parsed from the input
+ */
+ public static Command parse(String inputString) throws DukeException {
+ String input = inputString.trim();
+ String findCommand = input.split(" ")[0];
+ if (input.trim().equals("bye")) {
+ return new ExitCommand();
+ } else if (input.trim().equals("list")) {
+ return new ListCommand();
+ } else if (input.trim().equals("clear")) {
+ return new ClearCommand();
+ } else if (input.trim().equals("help")) {
+ return new HelpCommand();
+ } else if (findCommand.equals("done")) {
+ return prepareDone(input);
+ } else if (findCommand.equals("delete")) {
+ return prepareDelete(input);
+ } else if (findCommand.equals("find")) {
+ return prepareFind(input);
+ } else if (findCommand.equals("todo")) {
+ return prepareTodo(input);
+ } else if (findCommand.equals("deadline")) {
+ return prepareDeadline(input);
+ } else if (findCommand.equals("event")) {
+ return prepareEvent(input);
+ } else {
+ return new InvalidCommand();
+ }
+ }
+
+ /**
+ * Prepares the done command by extracting the index
+ *
+ * @param input Input string from the user
+ * @return DoneCommand DoneCommand got from the input
+ * @throws DukeException if the input is in an incorrect format
+ */
+ public static DoneCommand prepareDone(String input) throws DukeException {
+ int index;
+ try {
+ index = Integer.parseInt(input.split(" ")[1]) - 1;
+ } catch (NumberFormatException n) {
+ throw new DukeException("Please give a numerical index for 'done' command :-(");
+ } catch (IndexOutOfBoundsException i) {
+ throw new DukeException("Please give an index for 'done' command :-(");
+ }
+
+ return new DoneCommand(index);
+ }
+
+ /**
+ * Prepares the delete command by extracting the index
+ *
+ * @param input Input string from the user
+ * @return DeleteCommand DeleteCommand got from the input
+ */
+ public static DeleteCommand prepareDelete(String input) throws DukeException {
+ int index;
+ try {
+ index = Integer.parseInt(input.split(" ")[1]) - 1;
+ } catch (NumberFormatException n) {
+ throw new DukeException("Please give a numerical index for 'delete' command :-(");
+ } catch (IndexOutOfBoundsException i) {
+ throw new DukeException("Please give an index for 'delete' command :-(");
+ }
+
+ return new DeleteCommand(index);
+ }
+
+ /**
+ * Prepares the find command by extracting the description
+ *
+ * @param input Input string from the user
+ * @return FindCommand FindCommand got from the input
+ * @throws DukeException if the input is in an incorrect format
+ */
+ public static FindCommand prepareFind(String input) throws DukeException {
+ String description;
+ try {
+ description = input.substring(FIND_POS);
+ } catch (NumberFormatException n) {
+ throw new DukeException("Please give a numerical index for 'done' command :-(");
+ } catch (IndexOutOfBoundsException i) {
+ throw new DukeException("Please give a key word for 'find' command :-(");
+ }
+
+ return new FindCommand(description);
+ }
+
+ /**
+ * Prepares the add todo command by extracting the description
+ *
+ * @param input Input string from the user
+ * @return AddTodoCommand AddTodoCommand got from the input
+ * @throws DukeException if the input is in an incorrect format
+ */
+ public static AddTodoCommand prepareTodo(String input) throws DukeException {
+ String description;
+ try {
+ description = input.substring(TODO_POS);
+ } catch (IndexOutOfBoundsException i) {
+ throw new DukeException("Please give me a description for the task :-(");
+ }
+
+ return new AddTodoCommand(description);
+ }
+
+ /**
+ * Prepares the add deadline command by extracting the description and by time
+ *
+ * @param input Input string from the user
+ * @return AddDeadlineCommand AddDeadlineCommand got from the input
+ * @throws DukeException if the input is in an incorrect format
+ */
+ public static AddDeadlineCommand prepareDeadline(String input) throws DukeException {
+ int indexOfBy = input.indexOf("/by");
+ if (indexOfBy == -1) {
+ throw new DukeException("Please tell me when the deadline is by :-(");
+ }
+
+ String by;
+ try {
+ by = input.substring(indexOfBy + BY_POS);
+ } catch (IndexOutOfBoundsException i){
+ throw new DukeException("Please give me a time for the deadline :-(");
+ }
+
+ String description;
+ try {
+ description = input.substring(DEADLINE_POS, indexOfBy - 1);
+ } catch (IndexOutOfBoundsException i) {
+ throw new DukeException("Please give me a description for the deadline :-(");
+ }
+
+ return new AddDeadlineCommand(description, by);
+ }
+
+ /**
+ * Prepares the add event command by extracting the description and by time
+ *
+ * @param input Input string from the user
+ * @return AddEventCommand AddEventCommand got from the input
+ * @throws DukeException if the input is in an incorrect format
+ */
+ public static AddEventCommand prepareEvent(String input) throws DukeException {
+ int indexOfAt = input.indexOf("/at");
+ if (indexOfAt == -1) {
+ throw new DukeException("Please tell me when the event is at :-(");
+ }
+
+ String at;
+ try {
+ at = input.substring(indexOfAt + AT_POS);
+ } catch (IndexOutOfBoundsException i){
+ throw new DukeException("Please give me a time for the event :-(");
+ }
+
+ String description;
+ try {
+ description = input.substring(EVENT_POS, indexOfAt - 1);
+ } catch (IndexOutOfBoundsException i) {
+ throw new DukeException("Please give me a description for the event :-(");
+ }
+
+ return new AddEventCommand(description, at);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/Duke/Storage/Storage.java b/src/main/java/Duke/Storage/Storage.java
new file mode 100644
index 000000000..8dbaa3b1e
--- /dev/null
+++ b/src/main/java/Duke/Storage/Storage.java
@@ -0,0 +1,122 @@
+package Duke.Storage;
+
+import Duke.Tasks.Deadline;
+import Duke.Tasks.Event;
+import Duke.Tasks.Task;
+import Duke.Tasks.Todo;
+import Duke.DukeException.DukeException;
+import Duke.Ui.Ui;
+
+import java.io.*;
+import java.util.ArrayList;
+
+public class Storage {
+ private final String path;
+ private static final int TYPE_POS = 4;
+ private static final int TASK_POS = 10;
+ private final Ui ui = new Ui();
+
+ public Storage(String path) {
+ this.path = path;
+ }
+
+ /**
+ * Load the task record and copy it into current TaskList.
+ *
+ * @throws DukeException If file does not exist.
+ */
+ public ArrayList load() throws DukeException {
+ ArrayList tasks = new ArrayList();
+ File file = new File(path);
+ if (!file.exists()) {
+ throw new DukeException("No file can be loaded.");
+ }
+ BufferedReader reader = null;
+ try {
+ FileInputStream fileInputStream = new FileInputStream(path);
+ InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8");
+ reader = new BufferedReader(inputStreamReader);
+ String tempString = "";
+ Task task = new Task("null");
+
+ while ((tempString = reader.readLine()) != null) {
+ if (tempString.charAt(TYPE_POS) == 'T') {
+ task = (new Todo(tempString.substring(TASK_POS)));
+ } else if (tempString.charAt(TYPE_POS) == 'E') {
+ String event = tempString.substring(TASK_POS,
+ tempString.indexOf("(") - 1);
+ String at = tempString.substring(tempString.indexOf(":") + 2,
+ tempString.indexOf(")"));
+ task = (new Event(event, at));
+ } else if (tempString.charAt(TYPE_POS) == 'D') {
+ String deadline = tempString.substring(TASK_POS,
+ tempString.indexOf("(") - 1);
+ String by = tempString.substring(tempString.indexOf(":") + 2,
+ tempString.indexOf(")"));
+ task = (new Deadline(deadline, by));
+ }
+
+ if (tempString.charAt(7) == 'X') {
+ task.markedAsDone();
+ }
+
+ tasks.add(task);
+ }
+ reader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ if (tasks.size() > 0) {
+ ui.printSuccessfulLoading();
+ ui.showLine();
+ } else {
+ ui.printListEmptyMessage();
+ ui.showLine();
+ }
+ return tasks;
+ }
+
+ /**
+ * Save the content of current task list to the txt file.
+ *
+ * @param tasks Tasklist to be saved.
+ */
+ public final void save(ArrayList tasks) {
+ BufferedWriter writer = null;
+ File file = new File(this.path);
+ if(!file.exists()) {
+ try {
+ file.createNewFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ try {
+ writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file,false), "UTF-8"));
+ for (Task task : tasks) {
+ int i = 0;
+ writer.write(i + 1 + ". " + task.toString());
+ i++;
+ writer.write("\n");
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if(writer != null){
+ writer.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/src/main/java/Duke/Tasks/Deadline.java b/src/main/java/Duke/Tasks/Deadline.java
new file mode 100644
index 000000000..eadef12f4
--- /dev/null
+++ b/src/main/java/Duke/Tasks/Deadline.java
@@ -0,0 +1,27 @@
+package Duke.Tasks;
+
+public class Deadline extends Task {
+ public String by;
+
+ /**
+ * Create a Deadline class with given description and by time.
+ *
+ * @param description Description of the deadline task.
+ * @param by By time of the deadline task.
+ */
+ public Deadline(String description, String by) {
+ super(description);
+ this.by = by;
+ }
+
+ /**
+ * Present deadline in string of prescribed format.
+ *
+ * @return String presented deadline description format.
+ */
+ @Override
+ public String toString() {
+ return "[D]" + super.toString() + " (by: " + this.by
+ + ")";
+ }
+}
diff --git a/src/main/java/Duke/Tasks/Event.java b/src/main/java/Duke/Tasks/Event.java
new file mode 100644
index 000000000..0013f0ecf
--- /dev/null
+++ b/src/main/java/Duke/Tasks/Event.java
@@ -0,0 +1,27 @@
+package Duke.Tasks;
+
+public class Event extends Task {
+ public String at;
+
+ /**
+ * Create a Event class with given description and by time.
+ *
+ * @param description Description of the event task.
+ * @param by At time of the event task.
+ */
+ public Event(String description, String at) {
+ super(description);
+ this.at = at;
+ }
+
+ /**
+ * Present event in string of prescribed format.
+ *
+ * @return String presented event description format.
+ */
+ @Override
+ public String toString() {
+ return "[E]" + super.toString() + " (at: " + this.at
+ + ")";
+ }
+}
diff --git a/src/main/java/Duke/Tasks/Task.java b/src/main/java/Duke/Tasks/Task.java
new file mode 100644
index 000000000..1f25b754d
--- /dev/null
+++ b/src/main/java/Duke/Tasks/Task.java
@@ -0,0 +1,44 @@
+package Duke.Tasks;
+
+public class Task {
+ protected String description;
+ protected String isDone;
+
+ /**
+ * Create a Task class with given description.
+ *
+ * @param description Description of the task.
+ */
+ public Task(String description) {
+ this.description = description;
+ this.isDone = " ";
+ }
+
+ /**
+ * Get the description of the task.
+ *
+ * @return description Description of the task
+ */
+ public final String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Mark the task as done.
+ *
+ */
+ public final void markedAsDone() {
+ this.isDone = "X";
+ }
+
+ /**
+ * Present event in string of prescribed format.
+ *
+ * @return String presented event description format.
+ */
+ @Override
+ public String toString() {
+ String status;
+ return "[" + isDone + "] " + this.description;
+ }
+}
diff --git a/src/main/java/Duke/Tasks/TaskList.java b/src/main/java/Duke/Tasks/TaskList.java
new file mode 100644
index 000000000..5c8e2477a
--- /dev/null
+++ b/src/main/java/Duke/Tasks/TaskList.java
@@ -0,0 +1,130 @@
+package Duke.Tasks;
+
+import Duke.Tasks.*;
+import Duke.DukeException.DukeException;
+
+import java.util.ArrayList;
+
+public class TaskList {
+ private static ArrayList tasks;
+
+ /**
+ * Create a TaskList class with the given list of tasks
+ *
+ * @param tasks List of recorded tasks
+ */
+ public TaskList(ArrayList tasks) {
+ this.tasks = tasks;
+ }
+
+ /**
+ * Create a TaskList class of an empty list
+ *
+ */
+ public TaskList() {
+ this.tasks = new ArrayList();
+ }
+
+ /**
+ * Return the tasks in the TaskList
+ *
+ * @return tasks Tasks in the TaskList
+ */
+ public final ArrayList getTasks() {
+ return this.tasks;
+ }
+
+ /**
+ * Tell whether the TaskList is empty
+ *
+ * @return isEmpty Status of whether the TaskList is empty
+ */
+ public final boolean isEmpty() {
+ return this.tasks.size() == 0;
+ }
+
+ /**
+ * Get the number of tasks in the TaskList
+ *
+ * @return size Size of the TaskList
+ */
+ public final int getNumOfSize() {
+ return this.tasks.size();
+ }
+
+ /**
+ * Print the tasks in the TaskList
+ *
+ */
+ public final void printTasks() {
+ if (this.tasks.size() == 0) {
+ System.out.println("The current list is empty!\n");
+ } else {
+ int index = 1;
+ for (Task task : this.tasks) {
+ System.out.println(index++ + ". " + task.toString());
+ }
+ }
+ }
+
+ /**
+ * Clears the tasks in the Tasklist
+ *
+ */
+ public final void clearTasks() {
+ this.tasks = new ArrayList ();
+ }
+
+ public final Task deleteTask(int index) throws DukeException {
+ Task deletedTask;
+ try {
+ deletedTask = this.tasks.get(index);
+ this.tasks.remove(index);
+ } catch (IndexOutOfBoundsException i) {
+ throw new DukeException("The index is out of range, please enter a valid index :-(");
+ }
+ return deletedTask;
+ }
+
+ /**
+ * Sets a task in the TaskList of certain index as done
+ *
+ * @param index Index of the task to be set as done
+ * @throws DukeException If the index is out of range
+ */
+ public final Task setDone(int index) throws DukeException {
+ try {
+ this.tasks.get(index).markedAsDone();
+ return this.tasks.get(index);
+ } catch (IndexOutOfBoundsException i) {
+ throw new DukeException("The index is out of range, please enter a valid index :-(");
+ }
+ }
+
+ /**
+ * Finds a task in the TaskList with key word
+ *
+ * @param target Target key word for the matching task
+ */
+ public final ArrayList find(String target) {
+ ArrayList foundTasks = new ArrayList();
+ for (Task task : this.tasks) {
+ if (task.getDescription().contains(target)) {
+ foundTasks.add(task);
+ }
+ }
+ return foundTasks;
+ }
+
+ public final void addTodo(String description) {
+ this.tasks.add(new Todo(description));
+ }
+
+ public final void addDeadline(String description, String by) {
+ this.tasks.add(new Deadline(description, by));
+ }
+
+ public final void addEvent(String description, String at) {
+ this.tasks.add(new Event(description, at));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/Duke/Tasks/Todo.java b/src/main/java/Duke/Tasks/Todo.java
new file mode 100644
index 000000000..ff1afd68d
--- /dev/null
+++ b/src/main/java/Duke/Tasks/Todo.java
@@ -0,0 +1,25 @@
+package Duke.Tasks;
+
+import Duke.Tasks.Task;
+
+public class Todo extends Task {
+
+ /**
+ * Create a Todo class with given description.
+ *
+ * @param description Description of the todo task.
+ */
+ public Todo(String description) {
+ super(description);
+ }
+
+ /**
+ * Present todo in string of prescribed format.
+ *
+ * @return String presented todo description format.
+ */
+ @Override
+ public String toString() {
+ return "[T]" + super.toString();
+ }
+}
diff --git a/src/main/java/Duke/Ui/Ui.java b/src/main/java/Duke/Ui/Ui.java
new file mode 100644
index 000000000..314490684
--- /dev/null
+++ b/src/main/java/Duke/Ui/Ui.java
@@ -0,0 +1,112 @@
+package Duke.Ui;
+
+import Duke.Tasks.TaskList;
+import Duke.Tasks.Task;
+import Duke.Command.*;
+
+import java.util.Scanner;
+
+public class Ui {
+ public Ui() {
+
+ }
+
+ public static final String readCommand() {
+ Scanner input = new Scanner(System.in);
+ return input.nextLine();
+ }
+
+ public static final void showWelcome() {
+ String logo = " ____ _ \n"
+ + "| _ \\ _ _| | _____ \n"
+ + "| | | | | | | |/ / _ \\\n"
+ + "| |_| | |_| | < __/\n"
+ + "|____/ \\__,_|_|\\_\\___|\n";
+ System.out.println("Hello from\n" + logo);
+
+ showLine();
+ System.out.println("Hello! I'm Duke\n"
+ + "What can I do for you?\n");
+ showLine();
+ }
+
+ public static final void showLine() {
+ System.out.println(" * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . *\n");
+ }
+
+ public static final void printSuccessfulLoading() {
+ System.out.println("Tasks have been loaded.");
+ }
+
+ public static final void printListEmptyMessage() {
+ System.out.println("The current list is empty~");
+ }
+
+ public static final void printListMessage() {
+ System.out.println("Here are the tasks in your list: ");
+ }
+
+ public static final void printClearMessage() {
+ System.out.println("The tasks in your list have been cleared. ");
+ }
+
+ public static final void printDoneMessage(Task taskDone) {
+ System.out.println("Nice, I have marked this task as done: \n"
+ + taskDone.toString());
+ }
+
+ public static final void printFindMessage() {
+ System.out.println("Here are the matching tasks in your list: ");
+ }
+
+ public static final void printNoMatchingTaskMessage() {
+ System.out.println("There is no matching task in your list :-(");
+ }
+
+ public static final void printDeleteMessage(Task taskDeleted) {
+ System.out.println("Got it. I have deleted the task in your list! \n"
+ + taskDeleted.toString());
+ }
+
+ public static final void printInvalidCommandMessage() {
+ System.out.println("OOPS!!! I'm sorry, but I don't know what that means :-(\n"
+ + "Please give me a valid command.");
+ }
+
+ public static final void printAddTaskMessage(Task task) {
+ System.out.println("Got it. I have added the task to your list.\n"
+ + task.toString());
+ }
+
+ public static final void printNumOfTasks(TaskList tasks) {
+ System.out.println("Now you have " + tasks.getNumOfSize() + " task(s) in your list.");
+ }
+
+ public static final void showHelpMessage() {
+ System.out.println("Here are the usages of all commands:"
+ + "\n\n" + AddDeadlineCommand.COMMAND_DESCRIPTION
+ + "\n\n" + AddEventCommand.COMMAND_DESCRIPTION
+ + "\n\n" + AddTodoCommand.COMMAND_DESCRIPTION
+ + "\n\n" + ClearCommand.COMMAND_DESCRIPTION
+ + "\n\n" + DeleteCommand.COMMAND_DESCRIPTION
+ + "\n\n" + DoneCommand.COMMAND_DESCRIPTION
+ + "\n\n" + ExitCommand.COMMAND_DESCRIPTION
+ + "\n\n" + FindCommand.COMMAND_DESCRIPTION
+ + "\n\n" + HelpCommand.COMMAND_DESCRIPTION
+ + "\n\n" + ListCommand.COMMAND_DESCRIPTION);
+ }
+
+ public static final void showLoadingError() {
+ showLine();
+ System.out.println("No task list can be loaded.");
+ showLine();
+ }
+
+ public static final void showError(String message) {
+ System.out.println(message);
+ }
+
+ public static final void showByeMessage() {
+ System.out.println("Bye. Hope to see you soon~");
+ }
+}
diff --git a/src/main/java/DukeException.java b/src/main/java/DukeException.java
new file mode 100644
index 000000000..3e1e3c056
--- /dev/null
+++ b/src/main/java/DukeException.java
@@ -0,0 +1,11 @@
+public class DukeException extends Exception {
+
+ public DukeException() {
+ super();
+ }
+
+ public DukeException(String message) {
+ super(message);
+ }
+
+}
diff --git a/src/main/java/Event.java b/src/main/java/Event.java
new file mode 100644
index 000000000..b111f0b64
--- /dev/null
+++ b/src/main/java/Event.java
@@ -0,0 +1,14 @@
+public class Event extends Task {
+ public String at;
+
+ public Event(String description, String at) {
+ super(description);
+ this.at = at;
+ }
+
+ @Override
+ public String toString() {
+ return "[E]" + super.toString() + "(at: " + this.at
+ + ")";
+ }
+}
diff --git a/src/main/java/List.java b/src/main/java/List.java
new file mode 100644
index 000000000..eb883f3cc
--- /dev/null
+++ b/src/main/java/List.java
@@ -0,0 +1,42 @@
+public class List {
+ private static String[] currentList = new String[100];
+ public static int listSize = 0;
+ private static int[] isDone = new int[100];
+
+ public static void addToList(String input) {
+ currentList[listSize] = input;
+ listSize++;
+ System.out.println("____________________________________________________________\n"
+ + "Added: " + input + "\n"
+ + "____________________________________________________________\n");
+ }
+
+ public static void printItems() {
+ if (listSize == 0) {
+ System.out.println("The list is empty.");
+ } else {
+ for (int i = 1; i <= listSize; i++) {
+ System.out.print(i + ". " );
+ System.out.print("[");
+ if (isDone[i-1] == 1) {
+ System.out.print("X");
+ } else {
+ System.out.print(" ");
+ }
+ System.out.print("] " + currentList[i-1] + "\n");
+ }
+ }
+ }
+
+ public static void mark(int number) {
+ isDone[number-1] = 1;
+ }
+
+ public static void markedItems() {
+ for (int i = 0; i < isDone.length; i++) {
+ if (isDone[i] == 1) {
+ System.out.println("[X] " + currentList[i]);
+ }
+ }
+ }
+}
diff --git a/src/main/java/Task.java b/src/main/java/Task.java
new file mode 100644
index 000000000..d20f062a2
--- /dev/null
+++ b/src/main/java/Task.java
@@ -0,0 +1,19 @@
+public class Task {
+ protected String description;
+ protected String isDone;
+
+ public Task(String description) {
+ this.description = description;
+ this.isDone = " ";
+ }
+
+ public final void markedAsDone() {
+ this.isDone = "X";
+ }
+
+ @Override
+ public String toString() {
+ String status;
+ return "[" + isDone + "] " + this.description;
+ }
+}
diff --git a/src/main/java/Todo.java b/src/main/java/Todo.java
new file mode 100644
index 000000000..60bd80871
--- /dev/null
+++ b/src/main/java/Todo.java
@@ -0,0 +1,11 @@
+public class Todo extends Task{
+
+ public Todo(String description) {
+ super(description);
+ }
+
+ @Override
+ public String toString() {
+ return "[T]" + super.toString();
+ }
+}
diff --git a/src/main/java/list.java b/src/main/java/list.java
new file mode 100644
index 000000000..ed6d9c677
--- /dev/null
+++ b/src/main/java/list.java
@@ -0,0 +1,65 @@
+public class list {
+ private static String[] l = new String[100];
+ public static int listSize = 0;
+ private static String[] isDone = new String[100];
+ private static String[] type = new String[100];
+
+ public static void initializing() {
+ for (int i = 0; i < 100; i++) {
+ isDone[i] = " ";
+ type[i] = " ";
+ }
+ }
+
+ public static void addToList(String input) {
+ if (input.contains("todo")) {
+ l[listSize] = input.substring(5);
+ type[listSize] = "T";
+ } else if (input.contains("deadline")) {
+ String by = input.substring(input.indexOf("/") + 4);
+ l[listSize] = input.substring(9, input.indexOf("/")) + " (by: " + by
+ + ")";
+ type[listSize] = "D";
+ } else if (input.contains("event")) {
+ String at = input.substring(input.indexOf("/") + 4);
+ l[listSize] = input.substring(6, input.indexOf("/")) + "(at: " + at
+ + ")";
+ type[listSize] = "E";
+ }
+ listSize++;
+ System.out.println("____________________________________________________________\n"
+ + "Got it. I've added this task: \n"
+ + " [" + type[listSize - 1] + "]"
+ + "[" + isDone[listSize - 1] + "]"
+ + l[listSize - 1] + "\n"
+ + "Now you have " + listSize + " tasks in the list.\n"
+ + "____________________________________________________________\n");
+ }
+
+ public static void printItems(){
+ if (listSize == 0) {
+ System.out.println("The list is empty.");
+ System.out.println("The list is empty.");
+ return;
+ } else {
+ for (int i = 1; i <= listSize; i++){
+ System.out.print(i + ". " );
+ System.out.print("[" + type[i - 1] + "]" + "["
+ + isDone[i - 1] + "] " + l[i-1] + "\n");
+ }
+ }
+ }
+
+ public static void mark(int number){
+ isDone[number-1] = "X";
+ }
+
+ public static void printMarkedItems(){
+ for (int i=0;i
+
+ $PROJECT_DIR$/out/artifacts/main_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/out/production/main/Duke/.idea/misc.xml b/src/main/java/out/production/main/Duke/.idea/misc.xml
new file mode 100644
index 000000000..6dbc0d28c
--- /dev/null
+++ b/src/main/java/out/production/main/Duke/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/out/production/main/Duke/.idea/modules.xml b/src/main/java/out/production/main/Duke/.idea/modules.xml
new file mode 100644
index 000000000..122a9054e
--- /dev/null
+++ b/src/main/java/out/production/main/Duke/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/out/production/main/Duke/.idea/runConfigurations.xml b/src/main/java/out/production/main/Duke/.idea/runConfigurations.xml
new file mode 100644
index 000000000..797acea53
--- /dev/null
+++ b/src/main/java/out/production/main/Duke/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/out/production/main/Duke/.idea/vcs.xml b/src/main/java/out/production/main/Duke/.idea/vcs.xml
new file mode 100644
index 000000000..c2365ab11
--- /dev/null
+++ b/src/main/java/out/production/main/Duke/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/out/production/main/Duke/META-INF/MANIFEST.MF b/src/main/java/out/production/main/Duke/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..5699c7418
--- /dev/null
+++ b/src/main/java/out/production/main/Duke/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Duke.Duke
+
diff --git a/src/main/out/production/main/.idea/.gitignore b/src/main/out/production/main/.idea/.gitignore
new file mode 100644
index 000000000..73f69e095
--- /dev/null
+++ b/src/main/out/production/main/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/src/main/out/production/main/.idea/artifacts/main_jar.xml b/src/main/out/production/main/.idea/artifacts/main_jar.xml
new file mode 100644
index 000000000..161508e49
--- /dev/null
+++ b/src/main/out/production/main/.idea/artifacts/main_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/main_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/out/production/main/.idea/misc.xml b/src/main/out/production/main/.idea/misc.xml
new file mode 100644
index 000000000..6dbc0d28c
--- /dev/null
+++ b/src/main/out/production/main/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/out/production/main/.idea/modules.xml b/src/main/out/production/main/.idea/modules.xml
new file mode 100644
index 000000000..122a9054e
--- /dev/null
+++ b/src/main/out/production/main/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/out/production/main/.idea/runConfigurations.xml b/src/main/out/production/main/.idea/runConfigurations.xml
new file mode 100644
index 000000000..797acea53
--- /dev/null
+++ b/src/main/out/production/main/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/out/production/main/.idea/vcs.xml b/src/main/out/production/main/.idea/vcs.xml
new file mode 100644
index 000000000..c2365ab11
--- /dev/null
+++ b/src/main/out/production/main/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/out/production/main/Duke/Command/DeleteCommand.class b/src/main/out/production/main/Duke/Command/DeleteCommand.class
new file mode 100644
index 000000000..a997d6540
Binary files /dev/null and b/src/main/out/production/main/Duke/Command/DeleteCommand.class differ
diff --git a/src/main/out/production/main/Duke/Parser/Parser.class b/src/main/out/production/main/Duke/Parser/Parser.class
new file mode 100644
index 000000000..81c16941c
Binary files /dev/null and b/src/main/out/production/main/Duke/Parser/Parser.class differ
diff --git a/src/main/out/production/main/Duke/Tasks/TaskList.class b/src/main/out/production/main/Duke/Tasks/TaskList.class
new file mode 100644
index 000000000..e564876f4
Binary files /dev/null and b/src/main/out/production/main/Duke/Tasks/TaskList.class differ
diff --git a/src/main/out/production/main/Duke/Ui/Ui.class b/src/main/out/production/main/Duke/Ui/Ui.class
new file mode 100644
index 000000000..a04d42b6b
Binary files /dev/null and b/src/main/out/production/main/Duke/Ui/Ui.class differ
diff --git a/src/main/out/production/main/out/production/main/Duke/.idea/.gitignore b/src/main/out/production/main/out/production/main/Duke/.idea/.gitignore
new file mode 100644
index 000000000..73f69e095
--- /dev/null
+++ b/src/main/out/production/main/out/production/main/Duke/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/src/main/out/production/main/out/production/main/Duke/.idea/artifacts/main_jar.xml b/src/main/out/production/main/out/production/main/Duke/.idea/artifacts/main_jar.xml
new file mode 100644
index 000000000..161508e49
--- /dev/null
+++ b/src/main/out/production/main/out/production/main/Duke/.idea/artifacts/main_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/main_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/out/production/main/out/production/main/Duke/.idea/misc.xml b/src/main/out/production/main/out/production/main/Duke/.idea/misc.xml
new file mode 100644
index 000000000..6dbc0d28c
--- /dev/null
+++ b/src/main/out/production/main/out/production/main/Duke/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/out/production/main/out/production/main/Duke/.idea/modules.xml b/src/main/out/production/main/out/production/main/Duke/.idea/modules.xml
new file mode 100644
index 000000000..122a9054e
--- /dev/null
+++ b/src/main/out/production/main/out/production/main/Duke/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/out/production/main/out/production/main/Duke/.idea/runConfigurations.xml b/src/main/out/production/main/out/production/main/Duke/.idea/runConfigurations.xml
new file mode 100644
index 000000000..797acea53
--- /dev/null
+++ b/src/main/out/production/main/out/production/main/Duke/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/out/production/main/out/production/main/Duke/.idea/vcs.xml b/src/main/out/production/main/out/production/main/Duke/.idea/vcs.xml
new file mode 100644
index 000000000..c2365ab11
--- /dev/null
+++ b/src/main/out/production/main/out/production/main/Duke/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/out/production/main/out/production/main/Duke/META-INF/MANIFEST.MF b/src/main/out/production/main/out/production/main/Duke/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..5699c7418
--- /dev/null
+++ b/src/main/out/production/main/out/production/main/Duke/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Duke.Duke
+
diff --git a/src/main/tasks.txt b/src/main/tasks.txt
new file mode 100644
index 000000000..cdba8cd05
--- /dev/null
+++ b/src/main/tasks.txt
@@ -0,0 +1 @@
+1. [D][X] have lunch (by: tomorrow)