diff --git a/DukeData/tasks.txt b/DukeData/tasks.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..2c9a9745c5
--- /dev/null
+++ b/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: duke.Duke
+
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000000..a9dcd3e7cd
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,67 @@
+plugins {
+ id 'java'
+ id 'application'
+ id 'com.github.johnrengelman.shadow' version '5.1.0'
+ id 'checkstyle'
+}
+
+repositories {
+ mavenCentral()
+}
+
+checkstyle {
+ toolVersion = '10.2'
+}
+
+dependencies {
+ testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
+ testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
+}
+
+test {
+ useJUnitPlatform()
+
+ testLogging {
+ events "passed", "skipped", "failed"
+
+ showExceptions true
+ exceptionFormat "full"
+ showCauses true
+ showStackTraces true
+ showStandardStreams = false
+ }
+}
+
+application {
+ mainClassName = "duke.Launcher"
+}
+
+shadowJar {
+ archiveBaseName = "duke"
+ archiveClassifier = null
+}
+
+run{
+ standardInput = System.in
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ String javaFxVersion = '11'
+
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
+}
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000000..fb88cedfc2
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,434 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml
new file mode 100644
index 0000000000..135ea49ee0
--- /dev/null
+++ b/config/checkstyle/suppressions.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/README.md b/docs/README.md
index 8077118ebe..7b37e91c42 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,29 +1,172 @@
# User Guide
+## Duke Bot
+> "Your mind is for having ideas, not holding them." - David Allen ([source](https://dansilvestre.com/productivity-quotes/))
+
## Features
-### Feature-ABC
+### Feature-Adding Tasks
+
+You can add different types of tasks:
+- To Do
+- Deadline
+- Event
+
+### Feature-Marking Tasks
+
+You can mark tasks as completed when you are done with them.
+You can also unmark tasks, indicating uncompleted tasks.
+c
+### Feature-Delete Tasks
+
+You can delete tasks as and when you wish!
-Description of the feature.
+### Feature-List
-### Feature-XYZ
+You can ask Duke to display all tasks that you have currently.
-Description of the feature.
+### Feature-Finding Tasks
+
+You can pass in specific keywords to find tasks that match them!
+
+### Feature-Statistics
+
+You can gather certain user Statistics and Insights:
+1. How many tasks have you completed in the past week?
+2. How many tasks have you added in the past week?
+3. How productive you are?
## Usage
-### `Keyword` - Describe action
+### `Deadline' - Deadline task
+
+Example of usage:
+
+`deadline cs2102 assignment /by 2023-02-25`
+
+Expected outcome:
+
+Creates Deadline Task.
+
+```
+Got it. I've added this task:
+[D][] cs2102 assignment (by: Feb 17 2023)
+Now you have ... tasks in the list.
+```
-Describe the action and its outcome.
+### `Event' - Event task
Example of usage:
-`keyword (optional arguments)`
+`event career fair /from 2023-02-12 /to 2023-02-13`
Expected outcome:
+Creates Event Task.
+
+```
+Got it. I've added this task:
+[E][] career fair (from: Feb 12 2023 2359 to: Feb 13 2023 2359)
+Now you have ... tasks in the list.
+```
+
+### `ToDo' - ToDo task
+
+Example of usage:
+
+`todo borrow book`
+
+Creates ToDo Task.
+
Description of the outcome.
```
-expected output
+Got it. I've added this task:
+[T][] borrow book
+Now you have ... tasks in the list.
+```
+
+### `Mark / Unmark' - Mark/Unmark task
+
+You need to have tasks in your list in the first place.
+
+Example of usage:
+
+`mark 1`
+
+Expected outcome:
+
+Marking Deadline cs2102 assignment.
+
+```
+Nice! I have marked this Task as Done:
+[D][X] cs2102 assignment (by: Feb 17 2023)
```
+
+`unmark 1`
+
+Expected outcome:
+
+Unmarking Deadline cs2102 assignment.
+
+```
+Ok! I have unmarked this Task as not done yet:
+[D][] cs2102 assignment (by: Feb 17 2023)
+```
+
+### `Delete` - Deletes Task:
+
+`delete 1`
+
+Expected outcome:
+
+Suppose you only have added one To Do task of borrow book.
+
+```
+Noted!I have deleted the task for you:
+[T][] borrow book
+You have 0 tasks in this list.
+```
+
+
+### `List` - Shows all Tasks in List:
+
+`list`
+
+Expected outcome:
+
+Suppose you only added one To Do task of borrow book.
+
+```
+1.[T][X] borrow book
+```
+
+### `Find` - Find Tasks with matching keywords:
+
+`find book`
+
+Expected outcome:
+
+Suppose you have added one To Do task of borrow book.
+
+```
+Here are the matching tasks in your list:
+1.[T][X] borrow book
+```
+
+### `Statistics` - Displays User Statistics:
+
+`statistics`
+
+Expected outcome:
+
+Suppose you have added two task and completed one task.
+And you have 5 urgent tasks.
+
+```
+You have 5 Urgent tasks! You got to be more productive!
+You have added 2 tasks within the past week!
+You have completed 1 tasks within the past week!Good Job!
+```
+
+
diff --git a/docs/Ui.png b/docs/Ui.png
new file mode 100644
index 0000000000..1875d53718
Binary files /dev/null and b/docs/Ui.png differ
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000..f3d88b1c2f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000..b7c8c5dbf5
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000000..2fe81a7d95
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,183 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000000..62bd9b9cce
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,103 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java
deleted file mode 100644
index 5d313334cc..0000000000
--- a/src/main/java/Duke.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class Duke {
- public static void main(String[] args) {
- String logo = " ____ _ \n"
- + "| _ \\ _ _| | _____ \n"
- + "| | | | | | | |/ / _ \\\n"
- + "| |_| | |_| | < __/\n"
- + "|____/ \\__,_|_|\\_\\___|\n";
- System.out.println("Hello from\n" + logo);
- }
-}
diff --git a/src/main/java/duke/DialogBox.java b/src/main/java/duke/DialogBox.java
new file mode 100644
index 0000000000..7d7fbe50a2
--- /dev/null
+++ b/src/main/java/duke/DialogBox.java
@@ -0,0 +1,61 @@
+package duke;
+
+import java.io.IOException;
+import java.util.Collections;
+
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.fxml.FXML;
+import javafx.fxml.FXMLLoader;
+import javafx.geometry.Pos;
+import javafx.scene.Node;
+import javafx.scene.control.Label;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.HBox;
+
+/**
+ * An example of a custom control using FXML.
+ * This control represents a dialog box consisting of an ImageView to represent the speaker's face and a label
+ * containing text from the speaker.
+ */
+public class DialogBox extends HBox {
+ @FXML
+ private Label dialog;
+ @FXML
+ private ImageView displayPicture;
+
+ private DialogBox(String text, Image img) {
+ try {
+ FXMLLoader fxmlLoader = new FXMLLoader(duke.MainWindow.class.getResource("/view/DialogBox.fxml"));
+ fxmlLoader.setController(this);
+ fxmlLoader.setRoot(this);
+ fxmlLoader.load();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ dialog.setText(text);
+ displayPicture.setImage(img);
+ }
+
+ /**
+ * Flips the dialog box such that the ImageView is on the left and text on the right.
+ */
+ private void flip() {
+ ObservableList tmp = FXCollections.observableArrayList(this.getChildren());
+ Collections.reverse(tmp);
+ getChildren().setAll(tmp);
+ setAlignment(Pos.TOP_LEFT);
+ }
+
+ public static DialogBox getUserDialog(String text, Image img) {
+ return new DialogBox(text, img);
+ }
+
+ public static DialogBox getDukeDialog(String text, Image img) {
+ var db = new DialogBox(text, img);
+ db.flip();
+ return db;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/duke/Duke.java b/src/main/java/duke/Duke.java
new file mode 100644
index 0000000000..18e5759917
--- /dev/null
+++ b/src/main/java/duke/Duke.java
@@ -0,0 +1,83 @@
+package duke;
+
+import java.io.IOException;
+
+import duke.command.Command;
+
+/**
+ * Duke Program for our Chat bot.
+ */
+public class Duke {
+
+ /**
+ * Stores and Loads all the tasks in file.
+ */
+ private Storage storage;
+
+ /**
+ * User Interface for user.
+ */
+ private Ui ui;
+
+ /**
+ * Task List to store all tasks provided by users.
+ */
+ private TaskList taskList;
+
+ /**
+ * Checks if we have to exit the Program.
+ */
+ private boolean isExit = false;
+
+ /**
+ * Creates Duke.
+ */
+ public Duke() {
+ this.storage = new Storage();
+ this.ui = new Ui();
+ this.taskList = new TaskList();
+
+ try {
+ storage.loadTasks(taskList);
+ } catch (IOException | DukeException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ public static void main(String[] args) {
+ new Duke();
+ }
+
+ public Ui getUi() {
+ return ui;
+ }
+
+ public boolean getIsExit() {
+ return isExit;
+ }
+
+ public void exitDuke() {
+ isExit = true;
+ }
+
+ /**
+ * Returns the appropriate response for Duke, depending on user input.
+ *
+ * @param input User input.
+ * @return String of Duke's Response to be shown.
+ */
+ public String getResponse(String input) {
+ try {
+ Command c = Parser.stringToCommand(input);
+ String toReturn = c.execute(ui, storage, taskList);
+ storage.saveTasks(taskList);
+
+ if (c.isExit()) {
+ this.exitDuke();
+ }
+ return toReturn;
+ } catch (DukeException e) {
+ return ui.showError(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/duke/DukeException.java b/src/main/java/duke/DukeException.java
new file mode 100644
index 0000000000..86e1cfd368
--- /dev/null
+++ b/src/main/java/duke/DukeException.java
@@ -0,0 +1,14 @@
+package duke;
+
+/**
+ * Encapsulates the exceptions within chat bot.
+ */
+public class DukeException extends Exception {
+
+ /**
+ * Error message to be shown to user.
+ */
+ public DukeException(String message) {
+ super(message);
+ };
+}
diff --git a/src/main/java/duke/Launcher.java b/src/main/java/duke/Launcher.java
new file mode 100644
index 0000000000..e4ef6b4628
--- /dev/null
+++ b/src/main/java/duke/Launcher.java
@@ -0,0 +1,12 @@
+package duke;
+
+import javafx.application.Application;
+
+/**
+ * A launcher class to workaround classpath issues.
+ */
+public class Launcher {
+ public static void main(String[] args) {
+ Application.launch(Main.class, args);
+ }
+}
diff --git a/src/main/java/duke/Main.java b/src/main/java/duke/Main.java
new file mode 100644
index 0000000000..db593707b5
--- /dev/null
+++ b/src/main/java/duke/Main.java
@@ -0,0 +1,31 @@
+package duke;
+
+import java.io.IOException;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Scene;
+import javafx.scene.layout.AnchorPane;
+import javafx.stage.Stage;
+
+/**
+ * A GUI for Duke using FXML.
+ */
+public class Main extends Application {
+
+ private Duke duke = new Duke();
+
+ @Override
+ public void start(Stage stage) {
+ try {
+ FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/MainWindow.fxml"));
+ AnchorPane ap = fxmlLoader.load();
+ Scene scene = new Scene(ap);
+ stage.setScene(scene);
+ fxmlLoader.getController().setDuke(duke);
+ stage.show();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/duke/MainWindow.java b/src/main/java/duke/MainWindow.java
new file mode 100644
index 0000000000..f9a93fbee0
--- /dev/null
+++ b/src/main/java/duke/MainWindow.java
@@ -0,0 +1,60 @@
+package duke;
+
+import javafx.application.Platform;
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.control.TextField;
+import javafx.scene.image.Image;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.VBox;
+
+
+/**
+ * Controller for MainWindow. Provides the layout for the other controls.
+ */
+public class MainWindow extends AnchorPane {
+ @FXML
+ private ScrollPane scrollPane;
+ @FXML
+ private VBox dialogContainer;
+ @FXML
+ private TextField userInput;
+ @FXML
+ private Button sendButton;
+
+ private Duke duke;
+
+ private Image userImage = new Image(this.getClass().getResourceAsStream("/images/DaUser.png"));
+ private Image dukeImage = new Image(this.getClass().getResourceAsStream("/images/DaDuke.png"));
+
+ @FXML
+ public void initialize() {
+ scrollPane.vvalueProperty().bind(dialogContainer.heightProperty());
+ }
+
+ public void setDuke(Duke d) {
+ duke = d;
+ dialogContainer.getChildren().add(DialogBox.getDukeDialog(this.duke.getUi().printGreet(),
+ dukeImage));
+ }
+
+ /**
+ * Creates two dialog boxes, one echoing user input and the other containing Duke's reply and then appends them to
+ * the dialog container. Clears the user input after processing.
+ */
+ @FXML
+ private void handleUserInput() {
+ String input = userInput.getText();
+ String response = duke.getResponse(input);
+ dialogContainer.getChildren().addAll(
+ DialogBox.getUserDialog(input, userImage),
+ DialogBox.getDukeDialog(response, dukeImage)
+ );
+ userInput.clear();
+ if (duke.getIsExit()) {
+ Platform.exit();
+ System.exit(0);
+ }
+ }
+}
diff --git a/src/main/java/duke/Parser.java b/src/main/java/duke/Parser.java
new file mode 100644
index 0000000000..d57253059e
--- /dev/null
+++ b/src/main/java/duke/Parser.java
@@ -0,0 +1,105 @@
+package duke;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+import duke.command.AddCommand;
+import duke.command.Command;
+import duke.command.DeleteCommand;
+import duke.command.ErrorCommand;
+import duke.command.ExitCommand;
+import duke.command.FindCommand;
+import duke.command.ListCommand;
+import duke.command.MarkCommand;
+import duke.command.StatisticsCommand;
+import duke.command.UnmarkCommand;
+
+/**
+ * Parser class to convert to appriopriate types.
+ */
+public class Parser {
+
+ /**
+ * Formatter for String to LocalDateTime.
+ */
+ private static DateTimeFormatter strFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HHmm");
+
+ /**
+ * Formatter for LocalDateTime to String.
+ */
+ private static DateTimeFormatter ldtFormatter = DateTimeFormatter.ofPattern("MMM dd yyyy HHmm");
+
+
+ /**
+ * Formats a String to a Integer value.
+ *
+ * @param index the index of the task the user wants to fetch.
+ * @return an Integer.
+ */
+ public static Integer stringToInt(String index) {
+ return Integer.parseInt(index);
+ }
+
+ /**
+ * Converts the user input from a String to a Command class
+ * to carry out the necessary actions.
+ *
+ * @param command the users input.
+ * @return Command to carry out the necessary actions.
+ */
+ public static Command stringToCommand(String command) {
+ if (command.startsWith("delete")) {
+ return new DeleteCommand(command);
+ } else if (command.startsWith("mark")) {
+ return new MarkCommand(command);
+ } else if (command.startsWith("unmark")) {
+ return new UnmarkCommand(command);
+ } else if (command.equals("list")) {
+ return new ListCommand(command);
+ } else if (command.startsWith("todo") || command.startsWith("deadline") || command.startsWith("event")) {
+ return new AddCommand(command);
+ } else if (command.equals("bye")) {
+ return new ExitCommand("bye");
+ } else if (command.startsWith("find")) {
+ return new FindCommand(command);
+ } else if (command.equals("statistics")) {
+ return new StatisticsCommand("statistics");
+ } else {
+ return new ErrorCommand("error");
+ }
+ }
+
+ /**
+ * Parses the Date and Time to LocalDateTime.
+ *
+ * @param duration Date and Time given by the users.
+ * @return localDateTime object.
+ */
+ public static LocalDateTime stringToDateTime(String duration) {
+ LocalDateTime localDateTime = LocalDateTime.parse(duration, strFormatter);
+ return localDateTime;
+ }
+
+ /**
+ * Parses the LocalDateTime to Date and Time to Strings by following
+ * a certain format: MMM dd yyyy HHmm.
+ *
+ * @param localDateTime localDateTime recorded in the necessary task.
+ * @return Strings of Date and Time for the various tasks.
+ */
+ public static String dateTimeToString(LocalDateTime localDateTime) {
+ return localDateTime.format(ldtFormatter);
+ }
+
+ /**
+ * Parses the LocalDateTime to Date and Time to Strings by following
+ * a certain format: "yyyy-MM-dd HHmm". This is the format we will be
+ * saving the tasks in our Storage.
+ *
+ * @param localDateTime localDateTime recorded in the necessary task.
+ * @return Strings of Date and Time for the various tasks.
+ */
+ public static String dateTimeSaving(LocalDateTime localDateTime) {
+ return localDateTime.format(strFormatter);
+ }
+}
diff --git a/src/main/java/duke/Storage.java b/src/main/java/duke/Storage.java
new file mode 100644
index 0000000000..ae9c3bd5c4
--- /dev/null
+++ b/src/main/java/duke/Storage.java
@@ -0,0 +1,106 @@
+package duke;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Scanner;
+
+import duke.tasks.Deadline;
+import duke.tasks.Events;
+import duke.tasks.Task;
+import duke.tasks.ToDos;
+
+/**
+ * Storage to load and save tasks into files.
+ */
+public class Storage {
+
+ /**
+ * File path for saving the tasks.
+ */
+ private static String path = "DukeData/tasks.txt";
+
+ /**
+ * Directory Path.
+ */
+ private static String dirPath = "DukeData";
+
+ /**
+ * Creates Storage for Duke to load tasks from previous run
+ * and save tasks in the current run.
+ */
+ public Storage() {}
+
+ /**
+ * Saves the task into a separate file after each update from the user.
+ *
+ * @param taskList the current tasklist.
+ */
+ public void saveTasks(TaskList taskList) {
+ try {
+ String input = "";
+ FileWriter fw = new FileWriter(path);
+
+ for (Task tasks: taskList.tasks) {
+ input += (tasks.saveString() + "\n");
+ }
+ fw.write(input);
+ fw.close();
+ } catch (IOException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ /**
+ * Loads all the task from the previous run.
+ * Tasks are all saved in a separate file.
+ * Asserts that the file must exist when you are loading tasks in.
+ *
+ * @param taskList the current tasklist
+ * @throws IOException catch for Input and Output inconsistencies.
+ */
+ public void loadTasks(TaskList taskList) throws IOException, DukeException {
+ File folder = new File(dirPath);
+ if (!folder.exists()) {
+ folder.mkdirs();
+ }
+
+ File file = new File(path);
+ if (!file.exists()) {
+ file.createNewFile();
+ }
+
+ assert file.exists() : "File to save tasks does not exist!";
+
+ Scanner sc = new Scanner(file);
+
+ while (sc.hasNext()) {
+ String ref = sc.nextLine();
+ String[] text = ref.split("\\|");
+ Task curr = new Task("");
+
+ switch (text[0]) {
+ case "T":
+ curr = new ToDos(text[2], text[3]);
+ break;
+ case "D":
+ curr = new Deadline(text[2], text[3], text[4]);
+ break;
+ case "E":
+ curr = new Events(text[2], text[3], text[4], text[5]);
+ break;
+ default:
+ System.out.println("Error while Loading up the file");
+ break;
+ }
+
+ if (!curr.emptyTask()) {
+ if (text[1].equals("1")) {
+ curr.mark();
+ }
+ taskList.add(curr);
+ }
+ }
+ sc.close();
+ }
+}
diff --git a/src/main/java/duke/TaskAssigner.java b/src/main/java/duke/TaskAssigner.java
new file mode 100644
index 0000000000..ef4433e24b
--- /dev/null
+++ b/src/main/java/duke/TaskAssigner.java
@@ -0,0 +1,165 @@
+package duke;
+
+import java.time.format.DateTimeParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+import duke.tasks.Deadline;
+import duke.tasks.Events;
+import duke.tasks.Task;
+import duke.tasks.ToDos;
+
+/**
+ * Task Assigner to create the correct task type to be stored.
+ */
+public class TaskAssigner {
+
+ /**
+ * First Index of ToDo Description.
+ */
+ private static Integer TODO_DESCRIPTION_INDEX = 5;
+
+ /**
+ * First Index of Deadline Description.
+ */
+ private static Integer DEADLINE_DESCRIPTION_INDEX = 9;
+
+ /**
+ * Maximum size limit of String array when split for Deadline User input.
+ */
+ private static Integer DEADLINE_MAX_SIZE = 2;
+
+ /**
+ * Length of /ny in user input.
+ */
+ private static Integer LENGTH_OF_BY = 4;
+
+ /**
+ * First Index of Event Description.
+ */
+ private static Integer EVENT_DESCRIPTION_INDEX = 6;
+
+ /**
+ * Maximum size limit of String array when split for Event User input.
+ */
+ private static Integer EVENT_MAX_SIZE = 3;
+
+ /**
+ * Length of /from in user input.
+ */
+ private static Integer LENGTH_OF_FROM = 6;
+
+ /**
+ * Length of /to in user input.
+ */
+ private static Integer LENGTH_OF_TO = 4;
+
+ /**
+ * Constant to be minused off from index of the end date of event.
+ */
+ private static Integer LENGTH_OF_EVENT_END_TIME = 5;
+
+ /**
+ * Keywords to creating all types of tasks.
+ */
+ private static ArrayList taskTypes = new ArrayList<>(List.of("todo", "event", "deadline"));
+
+
+ /**
+ * Creates a Task Assigner for Duke.
+ * Responsible for creating either Deadline task, ToDo task or
+ * Event task depending on the user's input.
+ */
+ public TaskAssigner() {}
+
+ /**
+ * Creates either Deadline task, ToDo task or
+ * Event task depending on the user's input.
+ *
+ * @param command the user's command.
+ * @throws DukeException catch inconsistencies and error in the user's input.
+ */
+ public Task assignTask(String command) throws DukeException {
+ String[] seq = command.split(" ");
+ String keyWord = seq[0];
+
+ if (!taskTypes.contains(keyWord)) {
+ throw new DukeException("OOPS!!! I'm sorry, but I don't know what that means :-(\n");
+ }
+
+ if (seq.length == 1) {
+ throw new DukeException("OOPS!!! I'm sorry, but the description of a task cannot"
+ + " be empty \n");
+ }
+
+ if (keyWord.equals("todo")) {
+ return this.assignToDo(command);
+
+ } else if (keyWord.equals("event")) {
+ return this.assignEvent(command);
+ } else {
+ return this.assignDeadline(command);
+ }
+ }
+
+ /**
+ * Creates a ToDo task.
+ *
+ * @param command the user's command.
+ * @return a ToDo task.
+ */
+ public Task assignToDo(String command) {
+ return new ToDos(command.substring(TODO_DESCRIPTION_INDEX));
+ }
+
+ /**
+ * Creates a Deadline task
+ *
+ * @param command the user's command.
+ * @return a Deadline task.
+ * @throws DukeException if Date and Time formatting is incorrect
+ */
+ public Task assignDeadline(String command) throws DukeException {
+ String[] timestampsAsString = command.split("/by ");
+ if (timestampsAsString.length != DEADLINE_MAX_SIZE) {
+ throw new DukeException("Improper Deadline Format! deadline {desc} /by yyyy-mm-dd hhmm\n");
+ }
+
+ try {
+ int dateIndex = command.indexOf("/by ") + LENGTH_OF_BY;
+ String deadline = command.substring(dateIndex);
+ String updatedDeadline = TimeChecker.updateTime(deadline);
+ String deadlineDescription = command.substring(DEADLINE_DESCRIPTION_INDEX, dateIndex - LENGTH_OF_BY);
+ return new Deadline(deadlineDescription, updatedDeadline);
+ } catch (DateTimeParseException e) {
+ throw new DukeException("Improper Deadline Format! deadline {desc} /by yyyy-mm-dd hhmm\n");
+ }
+ }
+
+ /**
+ * Creates a Event task
+ *
+ * @param command the user's command.
+ * @return a Event task.
+ * @throws DukeException if Date and Time formatting is incorrect
+ */
+ public Task assignEvent(String command) throws DukeException {
+ String[] timestampsAsString = command.split("/from | /to ");
+ if (timestampsAsString.length != EVENT_MAX_SIZE) {
+ throw new DukeException("Improper Event Format! Follow:\n"
+ + "event {desc} /from yyyy-mm-dd hhmm /to yyyy-mm-dd hhmm\n");
+ }
+ try {
+ int startIndex = command.indexOf("/from") + LENGTH_OF_FROM;
+ int endIndex = command.indexOf("/to") + LENGTH_OF_TO;
+ String startDate = TimeChecker.updateTime(command.substring(startIndex,
+ endIndex - LENGTH_OF_EVENT_END_TIME));
+ String endDate = TimeChecker.updateTime(command.substring(endIndex));
+ String eventDescription = command.substring(EVENT_DESCRIPTION_INDEX, startIndex - LENGTH_OF_FROM);
+ return new Events(eventDescription, startDate, endDate);
+ } catch (DateTimeParseException e) {
+ throw new DukeException("Improper Event Format! Follow:\n"
+ + "event {desc} /from yyyy-mm-dd hhmm /to yyyy-mm-dd hhmm\n");
+ }
+ }
+}
diff --git a/src/main/java/duke/TaskList.java b/src/main/java/duke/TaskList.java
new file mode 100644
index 0000000000..e666c69d85
--- /dev/null
+++ b/src/main/java/duke/TaskList.java
@@ -0,0 +1,171 @@
+package duke;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+import duke.tasks.Task;
+
+/**
+ * Stores all the current tasks provided by the user.
+ */
+public class TaskList {
+
+ /**
+ * List to contain all Tasks provided by users.
+ */
+ protected List tasks;
+
+ /**
+ * Keep Track of number of tasks.
+ */
+ protected int numTasks;
+
+ /**
+ * Creates a new TaskList.
+ */
+ TaskList() {
+ tasks = new ArrayList<>();
+ numTasks = 0;
+ }
+
+ /**
+ * Returns the total number of tasks.
+ *
+ * @return the number of tasks in your TaskList.
+ */
+ public Integer getNumTasks() {
+ return numTasks;
+ }
+
+ /**
+ * Fetches the specific task and mark it as done.
+ *
+ * @param taskIndex the index of the specific task in the list.
+ * @return the marked task.
+ */
+ public Task markTask(int taskIndex) throws DukeException {
+ if (taskIndex > numTasks || taskIndex < 1) {
+ throw new DukeException("There is no such task available\n");
+ }
+
+ Task ref = this.tasks.get(taskIndex - 1);
+ ref.mark();
+ return ref;
+ }
+
+
+ /**
+ * Fetches the specific task and unmark it.
+ *
+ * @param taskIndex the index of the specific task in the list.
+ * @return the unmarked task.
+ */
+ public Task unmarkTask(int taskIndex) throws DukeException {
+
+ if (taskIndex > numTasks || taskIndex < 1) {
+ throw new DukeException("There is no such task available\n");
+ }
+ Task ref = this.tasks.get(taskIndex - 1);
+ ref.unmark();
+ return ref;
+ }
+
+ /**
+ * Adds a task to the TaskList.
+ *
+ * @param task a new task to be added.
+ */
+ public void add(Task task) {
+ tasks.add(task);
+ numTasks++;
+ }
+
+ /**
+ * Deletes a task to the TaskList.
+ *
+ * @param index the index of the specific task in the list.
+ * @return deleted task.
+ */
+ public Task deleteTask(int index) throws DukeException {
+ if (index > numTasks || index < 1) {
+ throw new DukeException("There is no such task available\n");
+ }
+
+ Task removed = tasks.remove(index - 1);
+ numTasks--;
+ return removed;
+ }
+
+ /**
+ * Prints all the tasks in the TaskList.
+ */
+ public String printTasks() throws DukeException {
+ if (numTasks == 0) {
+ throw new DukeException("You currently have no tasks mate!");
+ }
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < numTasks; i++) {
+ Task ref = tasks.get(i);
+ String taskToPrint = String.format("%d.%s\n", (i + 1) , ref.toString());
+ sb.append(taskToPrint);
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Provides the Statistics and Insights for the user.
+ *
+ * @return ArrayList of the different statistics of the user.
+ */
+ public ArrayList checkStatistics() {
+ ArrayList statistics = new ArrayList<>();
+ int totalUrgentTasks = 0;
+ int pastWeekCompletedTasks = 0;
+ int addedWithinWeek = 0;
+
+ LocalDateTime currentDateTime = LocalDateTime.now();
+ LocalDateTime pastWeek = currentDateTime.minusDays(7);
+
+ for (Task task : tasks) {
+ if (task.checkUrgent()) {
+ totalUrgentTasks++;
+ }
+
+ if (task.completedWithinWeek()) {
+ pastWeekCompletedTasks++;
+ }
+
+ if (task.addedWithinWeek()) {
+ addedWithinWeek++;
+ }
+ }
+
+ statistics.add(totalUrgentTasks);
+ statistics.add(addedWithinWeek);
+ statistics.add(pastWeekCompletedTasks);
+
+ return statistics;
+ }
+
+ /**
+ * Returns all the tasks that contain the specific keyword provided by the user.
+ *
+ * @param keyWord The keyword given by the user.
+ * @return ArrayList of all the tasks that contains the keyword.
+ */
+ public ArrayList getTasksByKeyWord(String keyWord) throws DukeException {
+ ArrayList allFoundTasks = new ArrayList<>();
+ for (Task task : tasks) {
+ if (task.containsKeyWord(keyWord)) {
+ allFoundTasks.add(task);
+ }
+ }
+ if (allFoundTasks.size() == 0) {
+ throw new DukeException(String.format("Unable to find any Tasks that contain this Keyword: %s\n", keyWord));
+ } else {
+ return allFoundTasks;
+ }
+ }
+}
diff --git a/src/main/java/duke/TimeChecker.java b/src/main/java/duke/TimeChecker.java
new file mode 100644
index 0000000000..f6ca4eebf5
--- /dev/null
+++ b/src/main/java/duke/TimeChecker.java
@@ -0,0 +1,35 @@
+package duke;
+
+import java.time.format.DateTimeFormatter;
+
+
+/**
+ * Checks and Updates the Time accordingly.
+ */
+public class TimeChecker {
+
+ /**
+ * Default time to be provided in case users do not specify time.
+ */
+ private static String DEFAULT_TIME = "2359";
+
+ /**
+ * Time Formatter.
+ */
+ private static DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HHmm");
+
+ /**
+ * Updates the Date and Time given by the users.
+ *
+ * @param timeline Date and Time given by Users.
+ * @return Updated Date and Time.
+ */
+ public static String updateTime(String timeline) {
+ String[] split = timeline.split(" ");
+ if (split.length == 2) {
+ return timeline;
+ } else {
+ return timeline + " " + DEFAULT_TIME;
+ }
+ }
+}
diff --git a/src/main/java/duke/Ui.java b/src/main/java/duke/Ui.java
new file mode 100644
index 0000000000..bc1aca47f3
--- /dev/null
+++ b/src/main/java/duke/Ui.java
@@ -0,0 +1,193 @@
+package duke;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+import duke.tasks.Task;
+
+/**
+ * User Interface for the Chat bot.
+ */
+public class Ui {
+
+ /**
+ * Prints the greeting message.
+ */
+ private static String GREET_MSG = "Hello! I am Duke Nice To Meet You\n";
+
+ /**
+ * Prints the GoodBye message.
+ */
+ private static String BYE_MSG = "Bye! Hope to See You Again!";
+
+ /**
+ * Prints the message when a task is added.
+ */
+ private static String ADD_MSG = "Got it fam! I've added this task:\n ";
+
+ /**
+ * Upper Bound for user productivity, measured against Urgent Tasks.
+ */
+ private static Integer PRODUCTIVITY_CHECK = 5;
+
+ /**
+ * Message to be printed if user not productive.
+ */
+ private static String PRODUCTIVITY_MSG = "You got to be more Productive!\n";
+
+
+ private Scanner sc;
+
+ /**
+ * Creates a Ui class for Duke.
+ */
+ public Ui() {
+ this.sc = new Scanner(System.in);
+ }
+
+ /**
+ * Fetches the next commands given by users.
+ *
+ * @return Command given by the users.
+ */
+ public String getCommand() {
+ return sc.nextLine();
+ }
+
+ /**
+ * Displays the various error messages to the user.
+ *
+ * @param errorMessage DukeException's error messages.
+ * @return Error Message.
+ */
+ public String showError(String errorMessage) {
+ return errorMessage;
+ }
+
+ /**
+ * Greets the user.
+ *
+ * @return greeting message.
+ */
+ public String printGreet() {
+ return GREET_MSG;
+ }
+
+ /**
+ * Says goodbye to the user.
+ *
+ * @return Goodbye message.
+ */
+ public String printBye() {
+ return BYE_MSG;
+ }
+
+
+ /**
+ * Displays all the tasks in his TaskList.
+ *
+ * @param taskList his current TaskList.
+ * @return String of all the tasks in the task list.
+ * @throws DukeException.
+ */
+ public String showList(TaskList taskList) throws DukeException {
+ try {
+ return taskList.printTasks();
+ } catch (DukeException e) {
+ return this.showError(e.getMessage());
+ }
+ }
+
+ /**
+ * Prints the task that's been completed by the user.
+ *
+ * @param markedTask task that is to be marked by the user
+ * @return String of the marked task.
+ */
+ public String printMarkTask(Task markedTask) {
+ return "Nice! I have marked this task as Done:\n" + markedTask.toString() + "\n";
+ }
+
+ /**
+ * Prints the task that's been added by the user.
+ * Prints the total number of tasks in his TaskList after adding the recent task.
+ *
+ * @param numTasks number of total tasks after addition.
+ * @param addedTask the task that's to be added.
+ * @return String of the added task by the user.
+ */
+ public String printAddTask(Task addedTask, Integer numTasks) {
+ return ADD_MSG + addedTask.toString() + "\nYou currently have " + numTasks + " tasks in this list!\n";
+ }
+
+ /**
+ * Prints the task that's been unmarked by the user.
+ *
+ * @param unmarkedTask the task thats been unmarked by user.
+ * @return String of that unmarked task.
+ */
+ public String printUnmarkTask(Task unmarkedTask) {
+ return "Ok! I have marked this task as not done yet:\n"
+ + unmarkedTask.toString() + "\n";
+ }
+
+ /**
+ * Prints the task that's been deleted by the user.
+ *
+ * @param removedTask the tasks that's removed.
+ * @param numTasks number of total tasks after deletion.
+ * @return String of that deleted task.
+ */
+ public String printDeleteTask(Task removedTask, Integer numTasks) {
+ return "Noted!I have deleted the task for you:\n "
+ + removedTask.toString() + "\nyou currently have " + numTasks
+ + " tasks in this list!\n";
+ }
+
+ /**
+ * Prints all the tasks that contain the keyword provided by the user.
+ *
+ * @param taskList list of tasks the user has.
+ * @param keyWord keyword input by the user.
+ * @return String of all the tasks that contains the keyword.
+ */
+ public String printTaskByKeyWord(TaskList taskList, String keyWord) throws DukeException {
+ ArrayList allFoundTasks = taskList.getTasksByKeyWord(keyWord);
+ int index = 1;
+ StringBuilder sb = new StringBuilder("Here are the matching tasks in your list:\n");
+ for (Task task : allFoundTasks) {
+ sb.append(String.format("%d.%s\n", index, task.toString()));
+ index++;
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Returns a String of all the statistics of the user.
+ *
+ * @param taskList list of tasks the user has.
+ * @return String representation of all the statistics of the user.
+ */
+ public String printStatistics(TaskList taskList) {
+ ArrayList statistics = taskList.checkStatistics();
+ int urgentTasks = statistics.get(0);
+ int addedTasks = statistics.get(1);
+ int completedTasks = statistics.get(2);
+
+ StringBuilder message = new StringBuilder(String.format("You have %d Urgent Tasks\n", urgentTasks));
+
+ if (urgentTasks >= PRODUCTIVITY_CHECK) {
+ message.append(PRODUCTIVITY_MSG);
+ }
+ String secondMessage = String.format("You have added %d Tasks within this week!\n"
+ + "You have completed %d tasks within this week!",
+ addedTasks, completedTasks);
+
+ message.append(secondMessage);
+ if (completedTasks > 0) {
+ message.append("Good Job!");
+ }
+
+ return message.toString();
+ }
+}
diff --git a/src/main/java/duke/command/AddCommand.java b/src/main/java/duke/command/AddCommand.java
new file mode 100644
index 0000000000..ade420d4d8
--- /dev/null
+++ b/src/main/java/duke/command/AddCommand.java
@@ -0,0 +1,46 @@
+package duke.command;
+
+import duke.DukeException;
+import duke.Storage;
+import duke.TaskAssigner;
+import duke.TaskList;
+import duke.Ui;
+import duke.tasks.Task;
+
+/**
+ * AddCommand creates a new task based on the user input.
+ * Adds the new task into our existing task list.
+ */
+public class AddCommand extends Command {
+
+ /**
+ * Returns either a Deadline, Event or ToDo task depending on user input.
+ */
+ protected TaskAssigner taskAssigner;
+
+ /**
+ * Creates an AddCommand.
+ *
+ * @param textCmd user input.
+ */
+ public AddCommand(String textCmd) {
+ super(textCmd);
+ this.taskAssigner = new TaskAssigner();
+ }
+
+ /**
+ * Creates a task based on the user input and stores it.
+ *
+ * @param taskList task list that stores all tasks.
+ * @param ui User interface for duke.
+ * @param storage Storage information for task.
+ * @return String output to be displayed by ChatBot.
+ * @throws DukeException
+ */
+ @Override
+ public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException {
+ Task addedTask = taskAssigner.assignTask(textCmd);
+ taskList.add(addedTask);
+ return ui.printAddTask(addedTask, taskList.getNumTasks());
+ }
+}
diff --git a/src/main/java/duke/command/Command.java b/src/main/java/duke/command/Command.java
new file mode 100644
index 0000000000..91a6ed9dbc
--- /dev/null
+++ b/src/main/java/duke/command/Command.java
@@ -0,0 +1,24 @@
+package duke.command;
+
+import duke.DukeException;
+import duke.Storage;
+import duke.TaskList;
+import duke.Ui;
+
+/**
+ * Command is an abstract class that encapsulates all Commands for the Chatbot.
+ */
+public abstract class Command {
+ protected boolean isExit;
+ protected String textCmd;
+
+ public Command(String textCmd) {
+ this.textCmd = textCmd;
+ this.isExit = false;
+ }
+
+ public abstract String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException;
+ public boolean isExit() {
+ return isExit;
+ }
+}
diff --git a/src/main/java/duke/command/DeleteCommand.java b/src/main/java/duke/command/DeleteCommand.java
new file mode 100644
index 0000000000..eb4e856641
--- /dev/null
+++ b/src/main/java/duke/command/DeleteCommand.java
@@ -0,0 +1,40 @@
+package duke.command;
+
+import duke.DukeException;
+import duke.Parser;
+import duke.Storage;
+import duke.TaskList;
+import duke.Ui;
+import duke.tasks.Task;
+
+/**
+ * DeleteCommand deletes a specific task provided by user.
+ */
+public class DeleteCommand extends Command {
+
+ private static Integer START_INDEX_OF_DESCRIPTION = 7;
+
+ /**
+ * Creates a DeleteCommand.
+ *
+ * @param textCmd user input.
+ */
+ public DeleteCommand(String textCmd) {
+ super(textCmd);
+ }
+
+ /**
+ * Deletes a specific task provided by the user.
+ *
+ * @param taskList task list containing all existing tasks.
+ * @param ui User interface for duke.
+ * @param storage Storage information for tasks.
+ * @return String output to be displayed by our Chatbot
+ * @throws DukeException
+ */
+ public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException {
+ Task removedTask = taskList.deleteTask(
+ Parser.stringToInt(textCmd.substring(START_INDEX_OF_DESCRIPTION)));
+ return ui.printDeleteTask(removedTask, taskList.getNumTasks());
+ }
+}
diff --git a/src/main/java/duke/command/ErrorCommand.java b/src/main/java/duke/command/ErrorCommand.java
new file mode 100644
index 0000000000..3c461dce1b
--- /dev/null
+++ b/src/main/java/duke/command/ErrorCommand.java
@@ -0,0 +1,34 @@
+package duke.command;
+
+import duke.DukeException;
+import duke.Storage;
+import duke.TaskList;
+import duke.Ui;
+
+/**
+ * ErrorCommand alerts to the user of an unknown command.
+ */
+public class ErrorCommand extends Command {
+
+ /**
+ * Creates an ErrorCommand.
+ *
+ * @param textCmd user input.
+ */
+ public ErrorCommand(String textCmd) {
+ super(textCmd);
+ }
+
+ /**
+ * Throws a DukeException to indicate to the user of an unknown command.
+ *
+ * @param taskList task list containing all existing tasks.
+ * @param ui User interface for duke.
+ * @param storage Storage information for tasks.
+ * @throws DukeException
+ */
+ @Override
+ public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException {
+ throw new DukeException("I have no idea whats that command mate!\n");
+ }
+}
diff --git a/src/main/java/duke/command/ExitCommand.java b/src/main/java/duke/command/ExitCommand.java
new file mode 100644
index 0000000000..017fe42c3d
--- /dev/null
+++ b/src/main/java/duke/command/ExitCommand.java
@@ -0,0 +1,36 @@
+package duke.command;
+
+import duke.DukeException;
+import duke.Storage;
+import duke.TaskList;
+import duke.Ui;
+
+/**
+ * ExitCommand exits the program.
+ */
+public class ExitCommand extends Command {
+
+
+ /**
+ * Creates an ExitCommand.
+ *
+ * @param textCmd user input.
+ */
+ public ExitCommand(String textCmd) {
+ super(textCmd);
+ }
+
+ /**
+ * Exits the program.
+ *
+ * @param taskList task list containing all existing tasks.
+ * @param ui User interface for duke.
+ * @param storage Storage information for tasks.
+ * @throws DukeException
+ */
+ @Override
+ public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException {
+ this.isExit = true;
+ return ui.printBye();
+ }
+}
diff --git a/src/main/java/duke/command/FindCommand.java b/src/main/java/duke/command/FindCommand.java
new file mode 100644
index 0000000000..05a58f634a
--- /dev/null
+++ b/src/main/java/duke/command/FindCommand.java
@@ -0,0 +1,52 @@
+package duke.command;
+
+import duke.DukeException;
+import duke.Storage;
+import duke.TaskList;
+import duke.Ui;
+
+/**
+ * FindCommand finds all the tasks in the tasks list with the given keyword.
+ */
+public class FindCommand extends Command {
+
+ private static Integer START_INDEX_OF_DESCRIPTION = 5;
+
+ /**
+ * Creates a FindCommand.
+ *
+ * @param textCmd user input.
+ */
+ public FindCommand(String textCmd) {
+ super(textCmd);
+ }
+
+ /**
+ * Produces a String for the GUI to read from.
+ * The String is the list of Tasks that contain that specific given keyword
+ *
+ * @param ui User Interface of Duke.
+ * @param storage storage of Duke.
+ * @param taskList task list containing all the tasks Duke is tracking.
+ * @return the String of all the tasks that contains the keyword.
+ * @throws DukeException
+ */
+ @Override
+ public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException {
+ String[] commandSplit = textCmd.split(" ");
+ String typeOfCommand = commandSplit[0];
+
+ if (!typeOfCommand.equals("find")) {
+ throw new DukeException("The Formatting of your Find Command Task is incorrect!\n"
+ + "Please follow this format: find {keyword}");
+ }
+
+ if (commandSplit.length == 1) {
+ throw new DukeException("The keyword for your Find Command cannot be blank!\n"
+ + "Please follow this format: find {keyword}");
+ }
+
+ String keyWord = textCmd.substring(START_INDEX_OF_DESCRIPTION);
+ return ui.printTaskByKeyWord(taskList, keyWord);
+ }
+}
diff --git a/src/main/java/duke/command/ListCommand.java b/src/main/java/duke/command/ListCommand.java
new file mode 100644
index 0000000000..469902825a
--- /dev/null
+++ b/src/main/java/duke/command/ListCommand.java
@@ -0,0 +1,34 @@
+package duke.command;
+
+import duke.DukeException;
+import duke.Storage;
+import duke.TaskList;
+import duke.Ui;
+
+/**
+ * ListCommand prints all the tasks in the current task list.
+ */
+public class ListCommand extends Command {
+
+ /**
+ * Creates a ListCommand.
+ *
+ * @param textCmd user input.
+ */
+ public ListCommand(String textCmd) {
+ super(textCmd);
+ }
+
+ /**
+ * Produces a String for the GUI to read from.
+ * The String is the list of Tasks in the task list.
+ *
+ * @param ui User Interface of Duke.
+ * @param storage storage of Duke.
+ * @param taskList task list containing all the tasks Duke is tracking.
+ * @return the String of all the tasks in the task list.
+ */
+ public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException {
+ return ui.showList(taskList);
+ }
+}
diff --git a/src/main/java/duke/command/MarkCommand.java b/src/main/java/duke/command/MarkCommand.java
new file mode 100644
index 0000000000..81b059e3ed
--- /dev/null
+++ b/src/main/java/duke/command/MarkCommand.java
@@ -0,0 +1,41 @@
+package duke.command;
+
+import duke.DukeException;
+import duke.Parser;
+import duke.Storage;
+import duke.TaskList;
+import duke.Ui;
+import duke.tasks.Task;
+
+
+/**
+ * MarkCommand marks the specific task as completed.
+ */
+public class MarkCommand extends Command {
+
+ private static Integer START_INDEX_OF_DESCRIPTION = 5;
+
+ /**
+ * Creates a MarkCommand.
+ *
+ * @param textCmd user input.
+ */
+ public MarkCommand(String textCmd) {
+ super(textCmd);
+ }
+
+ /**
+ * Marks the task at the specified index as done.
+ *
+ * @param ui User interface for duke.
+ * @param storage Storage information for tasks.
+ * @param taskList List of tasks.
+ * @return String output to be displayed by Chatbot.
+ * @throws DukeException
+ */
+ @Override
+ public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException {
+ Task markedTask = taskList.markTask(Parser.stringToInt(textCmd.substring(START_INDEX_OF_DESCRIPTION)));
+ return ui.printMarkTask(markedTask);
+ }
+}
diff --git a/src/main/java/duke/command/StatisticsCommand.java b/src/main/java/duke/command/StatisticsCommand.java
new file mode 100644
index 0000000000..5c797b371c
--- /dev/null
+++ b/src/main/java/duke/command/StatisticsCommand.java
@@ -0,0 +1,35 @@
+package duke.command;
+
+import duke.DukeException;
+import duke.Storage;
+import duke.TaskList;
+import duke.Ui;
+
+/**
+ * StatisticsCommand returns user insights and statistics.
+ */
+public class StatisticsCommand extends Command {
+
+ /**
+ * Creates a StatisticsCommand.
+ *
+ * @param textCmd user input.
+ */
+ public StatisticsCommand(String textCmd) {
+ super(textCmd);
+ }
+
+ /**
+ * Returns user statistics and insights.
+ *
+ * @param ui User interface for duke.
+ * @param storage Storage information for tasks.
+ * @param taskList List of tasks.
+ * @return String output to be displayed by Chat bot.
+ * @throws DukeException
+ */
+ @Override
+ public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException {
+ return ui.printStatistics(taskList);
+ }
+}
diff --git a/src/main/java/duke/command/UnmarkCommand.java b/src/main/java/duke/command/UnmarkCommand.java
new file mode 100644
index 0000000000..1a06ddd5fc
--- /dev/null
+++ b/src/main/java/duke/command/UnmarkCommand.java
@@ -0,0 +1,40 @@
+package duke.command;
+
+import duke.DukeException;
+import duke.Parser;
+import duke.Storage;
+import duke.TaskList;
+import duke.Ui;
+import duke.tasks.Task;
+
+/**
+ * UnmarkCommand unmarks the specific task.
+ */
+public class UnmarkCommand extends Command {
+
+ private static Integer START_INDEX_OF_DESCRIPTION = 7;
+
+ /**
+ * Creates an UnmarkCommand.
+ *
+ * @param textCmd user input.
+ */
+ public UnmarkCommand(String textCmd) {
+ super(textCmd);
+ }
+
+ /**
+ * Unmarks the task at the specified index as done.
+ *
+ * @param ui User interface for duke.
+ * @param storage Storage information for tasks.
+ * @param taskList List of tasks.
+ * @return String output to be displayed by Chatbot.
+ * @throws DukeException
+ */
+ @Override
+ public String execute(Ui ui, Storage storage, TaskList taskList) throws DukeException {
+ Task unmarkedTask = taskList.unmarkTask(Parser.stringToInt(textCmd.substring(START_INDEX_OF_DESCRIPTION)));
+ return ui.printUnmarkTask(unmarkedTask);
+ }
+}
diff --git a/src/main/java/duke/tasks/Deadline.java b/src/main/java/duke/tasks/Deadline.java
new file mode 100644
index 0000000000..0b5078e8f9
--- /dev/null
+++ b/src/main/java/duke/tasks/Deadline.java
@@ -0,0 +1,158 @@
+package duke.tasks;
+
+import java.time.LocalDateTime;
+
+import duke.Parser;
+
+/**
+ * Deadline Task.
+ */
+public class Deadline extends Task {
+
+ /**
+ * Default time that will be set, if user does not provide a time.
+ */
+ private static String DEFAULT_TIME = "2359";
+ private static Integer DAYS_IN_A_WEEK = 7;
+ protected LocalDateTime dateBy;
+
+ /**
+ * Date when this task is marked completed.
+ */
+ private LocalDateTime completionDate = null;
+
+ /**
+ * Date when this task is added.
+ */
+ private LocalDateTime addedDate;
+
+ /**
+ * Creates a Deadline task.
+ * Sets added date to current timing, when this method is called.
+ */
+ public Deadline(String description, String by) {
+ super(description);
+ this.dateBy = Parser.stringToDateTime(by);
+ this.addedDate = LocalDateTime.now();
+ }
+
+ /**
+ * Creates a Deadline task.
+ * Sets added date according to the date provided from the Storage file.
+ */
+ public Deadline(String description, String by, String addedDate) {
+ super(description);
+ this.dateBy = Parser.stringToDateTime(by);
+ this.addedDate = Parser.stringToDateTime(addedDate);
+ }
+
+ @Override
+ public String getStatusIcon() {
+ return super.getStatusIcon();
+ }
+
+ public String getBy() {
+ return Parser.dateTimeToString(dateBy);
+ }
+
+ @Override
+ public String getDescription() {
+ return super.getDescription();
+ }
+
+ /**
+ * Parses the LocalDateTime deadline date to a String.
+ */
+ public String parseBySaving() {
+ return Parser.dateTimeSaving(dateBy);
+ }
+
+ /**
+ * Parses the LocalDateTime added date to a String.
+ */
+ public String parseAddSaving() {
+ return Parser.dateTimeSaving(addedDate);
+ }
+
+ /**
+ * Marks the task as Done and set the Completion Date
+ */
+ @Override
+ public void mark() {
+ super.mark();
+ completionDate = LocalDateTime.now();
+ }
+
+ /**
+ * Unmarks the task and reset the Completion Date to null
+ */
+ @Override
+ public void unmark() {
+ super.unmark();
+ completionDate = null;
+ }
+
+ @Override
+ public boolean checkUrgent() {
+ if (isDone) {
+ return false;
+ } else {
+ LocalDateTime currentDateTime = LocalDateTime.now();
+ LocalDateTime softDeadLine = currentDateTime.plusDays(DAYS_IN_A_WEEK);
+ return (dateBy.isBefore(softDeadLine) || dateBy.isAfter(currentDateTime));
+ }
+ }
+
+ /**
+ * Returns if the current task is completed within the past week.
+ *
+ * @return a Boolean of the current task, whether is completed within the past week.
+ */
+ public boolean completedWithinWeek() {
+
+ LocalDateTime currentDateTime = LocalDateTime.now();
+ LocalDateTime pastWeek = currentDateTime.minusDays(DAYS_IN_A_WEEK);
+
+ if (isDone) {
+ return this.completionDate.isAfter(pastWeek)
+ && this.completionDate.isBefore(currentDateTime);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns if the current task is added within the past week.
+ *
+ * @return a Boolean of the current task, whether is added within the past week.
+ */
+ public boolean addedWithinWeek() {
+ LocalDateTime currentDateTime = LocalDateTime.now();
+ LocalDateTime pastWeek = currentDateTime.minusDays(DAYS_IN_A_WEEK);
+
+ return this.addedDate.isAfter(pastWeek)
+ && this.addedDate.isBefore(currentDateTime);
+ }
+
+ /**
+ * Produces a String that adheres to our Storage formatting
+ * holding all the relevant information.
+ *
+ * @return the String of the specific task for saving
+ */
+ @Override
+ public String saveString() {
+ return String.format("D|%s|%s|%s|%s", super.saveString(), super.description,
+ this.parseBySaving(), this.parseAddSaving());
+ }
+
+ /**
+ * All the Information of the Deadline task
+ *
+ * @return a String of all the information of the Deadline task to be printed by the Ui
+ */
+ @Override
+ public String toString() {
+ return String.format("[D]%s (by: %s)", super.toString(), this.getBy());
+ }
+}
diff --git a/src/main/java/duke/tasks/Events.java b/src/main/java/duke/tasks/Events.java
new file mode 100644
index 0000000000..d12f134e32
--- /dev/null
+++ b/src/main/java/duke/tasks/Events.java
@@ -0,0 +1,181 @@
+package duke.tasks;
+
+import java.time.LocalDateTime;
+
+import duke.DukeException;
+import duke.Parser;
+
+/**
+ * Event Task.
+ */
+public class Events extends Task {
+
+ /**
+ * Default time that will be set, if user does not provide a time.
+ */
+ private static String DEFAULT_TIME = "2359";
+ private static Integer DAYS_IN_A_WEEK = 7;
+
+ protected LocalDateTime startDate;
+ protected LocalDateTime endDate;
+
+ /**
+ * Date when this task is marked completed.
+ */
+ private LocalDateTime completionDate = null;
+
+ /**
+ * Date when this task is added.
+ */
+ private LocalDateTime addedDate;
+
+ /**
+ * Creates an Event task.
+ * Sets added date to current timing, when this method is called.
+ * @throws DukeException
+ */
+ public Events(String description, String startDate, String endDate) throws DukeException {
+ super(description);
+ this.startDate = Parser.stringToDateTime(startDate);
+ this.endDate = Parser.stringToDateTime(endDate);
+ this.addedDate = LocalDateTime.now();
+ if (this.endDate.isBefore(this.startDate)) {
+ throw new DukeException("Event is Invalid! Your Start Date is after your EndDate!");
+ }
+ }
+
+ /**
+ * Creates an Event task.
+ * Sets added date according to the date provided from the Storage file.
+ * @throws DukeException
+ */
+ public Events(String description, String startDate, String endDate, String addedDate) throws DukeException {
+ super(description);
+ this.startDate = Parser.stringToDateTime(startDate);
+ this.endDate = Parser.stringToDateTime(endDate);
+ this.addedDate = Parser.stringToDateTime(addedDate);
+ if (this.endDate.isBefore(this.startDate)) {
+ throw new DukeException("Event is Invalid! Your Start Date is after your EndDate!");
+ }
+ }
+
+ public String getStart() {
+ return Parser.dateTimeToString(startDate);
+ }
+
+ public String getEnd() {
+ return Parser.dateTimeToString(endDate);
+ }
+
+ @Override
+ public String getStatusIcon() {
+ return super.getStatusIcon();
+ }
+
+ @Override
+ public String getDescription() {
+ return super.getDescription();
+ }
+
+ /**
+ * Parses the LocalDateTime start date to a String.
+ */
+ public String parseStartSaving() {
+ return Parser.dateTimeSaving(startDate);
+ }
+
+ /**
+ * Parses the LocalDateTime end date to a String.
+ */
+ public String parseEndSaving() {
+ return Parser.dateTimeSaving(startDate);
+ }
+
+ /**
+ * Parses the LocalDateTime added date to a String.
+ */
+ public String parseAddSaving() {
+ return Parser.dateTimeSaving(addedDate);
+ }
+
+ /**
+ * Marks the task as Done and set the Completion Date
+ */
+ @Override
+ public void mark() {
+ super.mark();
+ completionDate = LocalDateTime.now();
+ }
+
+ /**
+ * Unmarks the task and reset the Completion Date to null
+ */
+ @Override
+ public void unmark() {
+ super.unmark();
+ completionDate = null;
+ }
+
+ @Override
+ public boolean checkUrgent() {
+ if (isDone) {
+ return false;
+ } else {
+ LocalDateTime currentDateTime = LocalDateTime.now();
+ LocalDateTime softDeadLine = currentDateTime.plusDays(DAYS_IN_A_WEEK);
+ return (endDate.isBefore(softDeadLine) || endDate.isAfter(currentDateTime));
+ }
+ }
+
+ /**
+ * Returns if the current task is completed within the past week.
+ *
+ * @return a Boolean of the current task, whether is completed within the past week.
+ */
+ public boolean completedWithinWeek() {
+
+ LocalDateTime currentDateTime = LocalDateTime.now();
+ LocalDateTime pastWeek = currentDateTime.minusDays(DAYS_IN_A_WEEK);
+
+ if (isDone) {
+ return this.completionDate.isAfter(pastWeek)
+ && this.completionDate.isBefore(currentDateTime);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns if the current task is added within the past week.
+ *
+ * @return a Boolean of the current task, whether is added within the past week.
+ */
+ public boolean addedWithinWeek() {
+ LocalDateTime currentDateTime = LocalDateTime.now();
+ LocalDateTime pastWeek = currentDateTime.minusDays(DAYS_IN_A_WEEK);
+
+ return this.addedDate.isAfter(pastWeek)
+ && this.addedDate.isBefore(currentDateTime);
+ }
+
+ /**
+ * Produces a String that adheres to our Storage formatting
+ * holding all the relevant information.
+ *
+ * @return the String of the specific task for saving
+ */
+ @Override
+ public String saveString() {
+ return String.format("E|%s|%s|%s|%s|%s", super.saveString(), super.description,
+ this.parseStartSaving(), this.parseEndSaving(), this.parseAddSaving());
+ }
+
+ /**
+ * Returns a String with all the Event Task Information.
+ *
+ * @return a String of all the information of the Event task to be printed by the Ui
+ */
+ public String toString() {
+ return String.format("[E]%s (from: %s to: %s)", super.toString(), this.getStart(), this.getEnd());
+ }
+}
diff --git a/src/main/java/duke/tasks/Task.java b/src/main/java/duke/tasks/Task.java
new file mode 100644
index 0000000000..3a24842b21
--- /dev/null
+++ b/src/main/java/duke/tasks/Task.java
@@ -0,0 +1,115 @@
+package duke.tasks;
+
+/**
+ * Encapsulation of the tasks stored in the Chatbot.
+ */
+public class Task {
+ protected String description;
+ protected boolean isDone;
+
+
+ /**
+ * Constructs a Task class with the basic information.
+ * Basic Information includes Description and Completion Status.
+ *
+ * @param description description of the user's task.
+ */
+ public Task(String description) {
+ this.description = description;
+ this.isDone = false;
+ }
+
+ /**
+ * Returns a String of the Completion Status of the task.
+ *
+ * @return a String that indicates whether the task is done.
+ */
+ public String getStatusIcon() {
+ return (isDone ? "[X]" : "[ ]");
+ }
+
+ public boolean getIsDone() {
+ return isDone;
+ }
+
+ /**
+ * Returns a boolean to see if the Task is urgent.
+ *
+ * @return a Boolean that indicates whether the task is Urgent.
+ */
+ public boolean checkUrgent() {
+ return false;
+ }
+
+
+ /**
+ * Returns Description of the task.
+ *
+ * @return a String that details the task
+ */
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Check if the task is null
+ *
+ * @return boolean to check if its a null task
+ */
+ public boolean emptyTask() {
+ if (description.equals("")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Mark the task as Done.
+ */
+ public void mark() {
+ this.isDone = true;
+ }
+
+ /**
+ * Unmark the task, indicating it is not done.
+ */
+ public void unmark() {
+ this.isDone = false;
+ }
+
+ public boolean completedWithinWeek() {
+ return false;
+ }
+
+ public boolean addedWithinWeek() {
+ return false;
+ }
+
+ public boolean containsKeyWord(String keyWord) {
+ return this.getDescription().contains(keyWord);
+ }
+
+ /**
+ * Returns the Completion Status of the task.
+ *
+ * @return Status of its completion status but in binary format for saving in Storage
+ */
+ public String saveString() {
+ if (isDone) {
+ return "1";
+ } else {
+ return "0";
+ }
+ }
+
+ /**
+ * All the Information of the task
+ *
+ * @return a String of all the information of the task to be printed by the Ui
+ */
+ @Override
+ public String toString() {
+ return String.format("%s %s", this.getStatusIcon(), this.getDescription());
+ }
+}
diff --git a/src/main/java/duke/tasks/ToDos.java b/src/main/java/duke/tasks/ToDos.java
new file mode 100644
index 0000000000..55f26a9036
--- /dev/null
+++ b/src/main/java/duke/tasks/ToDos.java
@@ -0,0 +1,125 @@
+package duke.tasks;
+
+import java.time.LocalDateTime;
+
+import duke.Parser;
+
+/**
+ * ToDo tasks.
+ */
+public class ToDos extends Task {
+
+ private static Integer DAYS_IN_A_WEEK = 7;
+
+ /**
+ * Date when this task is marked completed.
+ */
+ private LocalDateTime completionDate = null;
+
+ /**
+ * Date when this task is added.
+ */
+ private LocalDateTime addedDate;
+
+ /**
+ * Creates a ToDo task.
+ * Sets added date to current timing, when this method is called.
+ */
+ public ToDos(String description) {
+ super(description);
+ this.addedDate = LocalDateTime.now();
+ }
+
+ /**
+ * Creates a ToDo task.
+ * Sets added date according to the date provided from the Storage file.
+ */
+ public ToDos(String description, String addedDate) {
+ super(description);
+ this.addedDate = LocalDateTime.now();
+ this.addedDate = Parser.stringToDateTime(addedDate);
+ }
+
+ @Override
+ public String getStatusIcon() {
+ return super.getStatusIcon();
+ }
+
+ /**
+ * Parses the LocalDateTime added date to a String.
+ */
+ public String parseAddSaving() {
+ return Parser.dateTimeSaving(addedDate);
+ }
+
+ /**
+ * Produces a String that adheres to our Storage formatting
+ * holding all the relevant information.
+ *
+ * @return the String of the specific task for saving
+ */
+ @Override
+ public String saveString() {
+ return String.format("T|%s|%s|%s", super.saveString(), super.description,
+ this.parseAddSaving());
+ }
+
+ /**
+ * Marks the task as Done and set the Completion Date
+ */
+ @Override
+ public void mark() {
+ super.mark();
+ completionDate = LocalDateTime.now();
+ }
+
+ /**
+ * Unmarks the task and reset the Completion Date to null
+ */
+ @Override
+ public void unmark() {
+ super.unmark();
+ completionDate = null;
+ }
+
+ /**
+ * Returns if the current task is completed within the past week.
+ *
+ * @return a Boolean of the current task, whether is completed within the past week.
+ */
+ public boolean completedWithinWeek() {
+
+ LocalDateTime currentDateTime = LocalDateTime.now();
+ LocalDateTime pastWeek = currentDateTime.minusDays(DAYS_IN_A_WEEK);
+
+ if (isDone) {
+ return this.completionDate.isAfter(pastWeek)
+ && this.completionDate.isBefore(currentDateTime);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns if the current task is added within the past week.
+ *
+ * @return a Boolean of the current task, whether is added within the past week.
+ */
+ public boolean addedWithinWeek() {
+ LocalDateTime currentDateTime = LocalDateTime.now();
+ LocalDateTime pastWeek = currentDateTime.minusDays(DAYS_IN_A_WEEK);
+
+ return this.addedDate.isAfter(pastWeek)
+ && this.addedDate.isBefore(currentDateTime);
+ }
+
+ /**
+ * All the Information of the ToDos task
+ *
+ * @return a String of all the information of the ToDos task to be printed by the Ui
+ */
+ @Override
+ public String toString() {
+ return String.format("[T]%s", super.toString());
+ }
+}
diff --git a/src/main/resources/images/DaDuke.png b/src/main/resources/images/DaDuke.png
new file mode 100644
index 0000000000..836034c645
Binary files /dev/null and b/src/main/resources/images/DaDuke.png differ
diff --git a/src/main/resources/images/DaUser.png b/src/main/resources/images/DaUser.png
new file mode 100644
index 0000000000..051cffb558
Binary files /dev/null and b/src/main/resources/images/DaUser.png differ
diff --git a/src/main/resources/view/DialogBox.fxml b/src/main/resources/view/DialogBox.fxml
new file mode 100644
index 0000000000..e433809947
--- /dev/null
+++ b/src/main/resources/view/DialogBox.fxml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml
new file mode 100644
index 0000000000..832f84382e
--- /dev/null
+++ b/src/main/resources/view/MainWindow.fxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/seedu/duke/DeadlineTest.java b/src/test/java/seedu/duke/DeadlineTest.java
new file mode 100644
index 0000000000..24aeb7175b
--- /dev/null
+++ b/src/test/java/seedu/duke/DeadlineTest.java
@@ -0,0 +1,21 @@
+package seedu.duke;
+
+import duke.tasks.Deadline;
+
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class DeadlineTest {
+ @Test
+ public void testFetchingDescription() {
+ Deadline deadline = new Deadline("return book", "2022-12-12 2330");
+ assertEquals("[D][ ] return book (by: Dec 12 2022 2330)", deadline.toString());
+ }
+
+ @Test
+ public void testMarking(){
+ Deadline deadline = new Deadline("return book", "2022-12-12 2330");
+ deadline.mark();
+ assertEquals("[D][X] return book (by: Dec 12 2022 2330)", deadline.toString());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/seedu/duke/ToDoTest.java b/src/test/java/seedu/duke/ToDoTest.java
new file mode 100644
index 0000000000..dae8ead815
--- /dev/null
+++ b/src/test/java/seedu/duke/ToDoTest.java
@@ -0,0 +1,22 @@
+package seedu.duke;
+
+import duke.tasks.ToDos;
+
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class ToDoTest {
+ @Test
+ public void testFetchingDescription() {
+ ToDos toDoTask = new ToDos("return book");
+ assertEquals("[T][ ] return book", toDoTask.toString());
+ }
+
+ @Test
+ public void testMarking(){
+ ToDos toDoTask = new ToDos("return book");
+ toDoTask.mark();
+ assertEquals("[T][X] return book", toDoTask.toString());
+ }
+
+}
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 657e74f6e7..b2217d96fe 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,7 +1,7 @@
-Hello from
- ____ _
-| _ \ _ _| | _____
-| | | | | | | |/ / _ \
-| |_| | |_| | < __/
-|____/ \__,_|_|\_\___|
+Hello! I am Duke Nice To Meet You
+Got it fam! I've added this task:
+ borrow book
+You currently have 1 task
+
+Bye! Hope to See You Again!
\ No newline at end of file
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index e69de29bb2..bcdc399f76 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -0,0 +1,3 @@
+todo borrow book
+bye
+
diff --git a/text-ui-test/runtest.sh b/text-ui-test/runtest.sh
old mode 100644
new mode 100755