diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000000..9b18c96ffb
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,11 @@
+name: CI
+
+on: [pull_request, push]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Check Compilation and Style
+ run: ./gradlew check
diff --git a/.gitignore b/.gitignore
index f69985ef1f..083487f24e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,10 +3,14 @@
/out/
/*.iml
+# VS Code files
+/.vscode/
+
# Gradle build files
/.gradle/
/build/
src/main/resources/docs/
+.class
# MacOS custom attributes files created by Finder
.DS_Store
diff --git a/README.md b/README.md
index 8715d4d915..cca9ac41c4 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,24 @@
# Duke project template
-This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.
+This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are
+instructions on how to use it.
## Setting up in Intellij
Prerequisites: JDK 11, update Intellij to the most recent version.
-1. Open Intellij (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project first)
+1. Open Intellij (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project
+ first)
1. Open the project into Intellij as follows:
- 1. Click `Open`.
- 1. Select the project directory, and click `OK`.
- 1. If there are any further prompts, accept the defaults.
-1. Configure the project to use **JDK 11** (not other versions) as explained in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).
+ 1. Click `Open`.
+ 1. Select the project directory, and click `OK`.
+ 1. If there are any further prompts, accept the defaults.
+1. Configure the project to use **JDK 11** (not other versions) as explained
+ in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).
In the same dialog, set the **Project language level** field to the `SDK default` option.
-3. After that, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
+3. After that, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()` (if the code
+ editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the
+ below as the output:
```
Hello from
____ _
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000000..3b37ec073b
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,61 @@
+plugins {
+ id 'java'
+ id 'application'
+ id 'com.github.johnrengelman.shadow' version '5.1.0'
+ id 'checkstyle'
+}
+
+checkstyle {
+ toolVersion = '10.2'
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation 'org.junit.jupiter:junit-jupiter-api:5.5.1'
+ 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'
+
+ 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'
+}
+
+test {
+ useJUnitPlatform()
+
+ testLogging {
+ events "passed", "skipped", "failed"
+
+ showExceptions true
+ exceptionFormat "full"
+ showCauses true
+ showStackTraces true
+ showStandardStreams = false
+ }
+}
+
+application {
+ mainClassName = "Launcher"
+}
+
+shadowJar {
+ archiveBaseName = "duke"
+ archiveClassifier = null
+}
+
+run {
+ standardInput = System.in
+}
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000000..d618671b83
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,434 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml
new file mode 100644
index 0000000000..39efb6e4ac
--- /dev/null
+++ b/config/checkstyle/suppressions.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
diff --git a/docs/README.md b/docs/README.md
index 8077118ebe..d8b5d635a0 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -2,28 +2,163 @@
## Features
-### Feature-ABC
+### Schedule Deadlines and Events
+Schedule set deadlines for important events and tasks!
-Description of the feature.
+### Create TODOs
+Create quick to dos to help keep your tasks on track.
-### Feature-XYZ
-
-Description of the feature.
+### View Deadlines
+Easily keep on track with your tasks by viewing upcoming deadlines.
## Usage
-### `Keyword` - Describe action
+### `todo`
-Describe the action and its outcome.
+Create a new todo, a task with no deadlines or timeframe.
Example of usage:
-`keyword (optional arguments)`
+`todo a new task`
+
+Expected outcome:
+
+A new task will be created.
+
+```
+Got it. I've added this task:[T][] a new task
+Now you have 1 tasks in the list.
+```
+
+### `deadline`
+
+Create a deadline with a due date
+
+Example of usage:
+
+`deadline homework /by 2022-09-22 23:59`
+
+Expected outcome:
+
+A new deadline will be created with this due date
+
+```
+Got it. I've added this task:[D][] homework (by: Sep 22 2022 23:59)
+Now you have 1 tasks in the list.
+```
+
+### `event`
+
+Create an event with a ranged date
+
+Example of usage:
+
+`event an event /at friday - saturday`
+
+Expected outcome:
+
+A new event with a ranged date
+
+```
+Got it. I've added this task:[E][] an event (at: friday - saturday)
+Now you have 1 tasks in the list.
+```
+
+### `list`
+
+Show a list of all tasks
+
+Example of usage:
+
+`list`
+
+Expected outcome:
+
+A list of all current tasks
+
+```
+1. [E][] an event (at: friday - saturday)
+2. [T][] A Todo
+```
+
+### `find`
+
+Find a specified task in a list of tasks
+
+Example of usage:
+
+`find A Todo`
Expected outcome:
-Description of the outcome.
+A list of tasks that match the keyword
```
-expected output
+1. [T][] A Todo
```
+
+### `schedule`
+
+Display all deadlines that are scheduled for this day
+
+Example of usage:
+
+`schedule 2022-09-25`
+
+Expected outcome:
+
+A list of all current tasks due on this date
+
+```
+1. [D][] A Deadline (by: Sep 25 2022 12:00)
+2. [D][] Another Deadline (by: Sep 25 2022 13:00)
+```
+
+### `mark`
+
+Mark a task as complete
+
+Example of usage:
+
+`mark 1`
+
+Expected outcome:
+
+```
+Nice! I've marked this task as done.
+[T][X] A Task
+```
+
+### `unmark`
+
+Mark a task as incomplete
+
+Example of usage:
+
+`unmark 1`
+
+Expected outcome:
+
+```
+OK, I've marked this task as not done yet:
+[T][] A Task
+```
+
+### `delete`
+
+delete an unwanted task
+
+Example of usage:
+
+`delete 1`
+
+Expected outcome:
+
+```
+Noted. I've removed this task:[T][] A Task
+Now you have 2 tasks in the list
+```
+
+
+
+
diff --git a/docs/Ui.png b/docs/Ui.png
new file mode 100644
index 0000000000..e110fb64e3
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/DialogBox.java b/src/main/java/DialogBox.java
new file mode 100644
index 0000000000..f578c16b2c
--- /dev/null
+++ b/src/main/java/DialogBox.java
@@ -0,0 +1,59 @@
+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(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;
+ }
+}
diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java
index 5d313334cc..f565c88cfc 100644
--- a/src/main/java/Duke.java
+++ b/src/main/java/Duke.java
@@ -1,10 +1,18 @@
+import duke.AllTasksList;
+import duke.Command;
+import duke.Storage;
+
+
+/**
+ * The main driver class for duke
+ *
+ * @author Cui Shen Yi
+ * @version CS2103T AY22/23 Semester 1
+ */
public class Duke {
- public static void main(String[] args) {
- String logo = " ____ _ \n"
- + "| _ \\ _ _| | _____ \n"
- + "| | | | | | | |/ / _ \\\n"
- + "| |_| | |_| | < __/\n"
- + "|____/ \\__,_|_|\\_\\___|\n";
- System.out.println("Hello from\n" + logo);
+ protected String getResponse(String input) {
+ AllTasksList allTasks = Storage.loadTasks();
+ String userOutput = Command.chat(input, allTasks);
+ return userOutput;
}
}
diff --git a/src/main/java/Launcher.java b/src/main/java/Launcher.java
new file mode 100644
index 0000000000..ca566098aa
--- /dev/null
+++ b/src/main/java/Launcher.java
@@ -0,0 +1,17 @@
+import duke.Storage;
+import javafx.application.Application;
+
+/**
+ * A launcher class to workaround classpath issues.
+ */
+public class Launcher {
+ /**
+ * Main driver class used to launch the application.
+ *
+ * @param args
+ */
+ public static void main(String[] args) {
+ Storage.initStorage();
+ Application.launch(Main.class, args);
+ }
+}
diff --git a/src/main/java/Main.java b/src/main/java/Main.java
new file mode 100644
index 0000000000..5bbcf5d55c
--- /dev/null
+++ b/src/main/java/Main.java
@@ -0,0 +1,29 @@
+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/MainWindow.java b/src/main/java/MainWindow.java
new file mode 100644
index 0000000000..a923569cb6
--- /dev/null
+++ b/src/main/java/MainWindow.java
@@ -0,0 +1,49 @@
+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;
+ }
+
+ /**
+ * 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();
+ }
+}
diff --git a/src/main/java/duke/AllTasksList.java b/src/main/java/duke/AllTasksList.java
new file mode 100644
index 0000000000..e4ae193cb0
--- /dev/null
+++ b/src/main/java/duke/AllTasksList.java
@@ -0,0 +1,144 @@
+package duke;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+import java.util.ArrayList;
+
+/**
+ * All Tasks List class used to store the tasks created by the user.
+ *
+ * @author Cui Shen Yi
+ * @version CS2103T AY22/23 Semester 1
+ */
+public class AllTasksList implements Serializable {
+
+ /**
+ * ArrayList used to store all the tasks created by the user
+ */
+ private ArrayList allTasks = new ArrayList<>();
+
+ /**
+ * Method used to mark a task at index as complete
+ *
+ * @param index the index of task to mark as complete
+ * @throws DukeException
+ */
+ public String markTask(int index) throws DukeException {
+ try {
+ return this.allTasks.get(index).markAsDone();
+ } catch (IndexOutOfBoundsException e) {
+ throw new DukeException("Error: duke.Task not found");
+ }
+ }
+
+ /**
+ * Method used to mark a task at index as incomplete
+ *
+ * @param index the index of task to mark as incomplete
+ * @throws DukeException
+ */
+ public String unMarkTask(int index) throws DukeException {
+ try {
+ return this.allTasks.get(index).unmark();
+ } catch (IndexOutOfBoundsException e) {
+ throw new DukeException("Error: duke.Task not found");
+ }
+ }
+
+ /**
+ * Method used to mark a task at index as incomplete
+ *
+ * @param index the index of task to mark as incomplete
+ * @throws DukeException
+ */
+ public String delete(int index) throws DukeException {
+ try {
+ String output = "\nNoted. I've removed this task:" + this.allTasks.get(index) + "\n";
+ this.allTasks.remove(index);
+ output += this.getSize();
+ return output;
+ } catch (IndexOutOfBoundsException e) {
+ throw new DukeException("Error: duke.Task not found");
+ }
+ }
+
+ /**
+ * Method used to add a new task
+ *
+ * @param task the task to be added
+ */
+ public String addTask(Task task) {
+ String output = "\nGot it. I've added this task:" + task + "\n";
+ this.allTasks.add(task);
+ output += this.getSize();
+ return output;
+ }
+
+ /**
+ * Method used to mark to list all available tasks
+ */
+ public String listAllTasks() {
+ String output = "";
+ for (int i = 0; i < this.allTasks.size(); i++) {
+ output += "\n" + (i + 1) + ". " + this.allTasks.get(i).toString();
+ }
+ return output;
+ }
+
+ /**
+ * Method used to list all deadlines that have the same due date.
+ *
+ * @param dueDate used to list all deadlines with this due date
+ * @return a string of all deadlines with this due date
+ * @throws DukeException if the due date is malformed
+ */
+ public String listSchedule(String dueDate) throws DukeException {
+ try {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
+ LocalDateTime date = LocalDateTime.parse(dueDate + " 00:00", formatter);
+ String output = "";
+ for (int i = 0; i < this.allTasks.size(); i++) {
+ Boolean isDeadline = this.allTasks.get(i) instanceof Deadline;
+ if (!isDeadline) {
+ continue;
+ }
+ Deadline dl = (Deadline) this.allTasks.get(i);
+ Boolean isSameDate = dl.isSameDay(date);
+ if (!isSameDate) {
+ continue;
+ }
+
+ output += "\n" + (i + 1) + ". " + this.allTasks.get(i).toString();
+ }
+ return output;
+ } catch (DateTimeParseException e) {
+ throw new DukeException("Date Format Incorrect: yyyy-MM-dd");
+ }
+ }
+
+ /**
+ * Method used to output to the user the number of items left on the list
+ */
+ private String getSize() {
+ return "Now you have " + this.allTasks.size() + " tasks in the list.";
+ }
+
+ /**
+ * Method used to find a specified item and return a list of items to the user
+ *
+ * @param searchItem the item to search for
+ */
+ public String find(String searchItem) {
+ ArrayList allTaskCopy = new ArrayList<>();
+ allTaskCopy.addAll(this.allTasks);
+ allTaskCopy.removeIf(s -> s.toString().contains(searchItem));
+
+ String output = "";
+ for (int i = 0; i < allTaskCopy.size(); i++) {
+ output += "\n" + (i + 1) + ". " + allTaskCopy.get(i).toString();
+ }
+ return output;
+ }
+}
diff --git a/src/main/java/duke/Command.java b/src/main/java/duke/Command.java
new file mode 100644
index 0000000000..ac49f81f73
--- /dev/null
+++ b/src/main/java/duke/Command.java
@@ -0,0 +1,198 @@
+package duke;
+
+/**
+ * Enum class used to store the command flags and execution logic of the various available commands.
+ *
+ * @author Cui Shen Yi
+ * @version CS2103T AY22/23 Semester 1
+ */
+public enum Command {
+ /**
+ * duke.Command to list all available Tasks
+ */
+ list,
+ /**
+ * duke.Command to create a new duke.Todo
+ */
+ todo,
+ /**
+ * duke.Command to create a new duke.Deadline
+ */
+ deadline,
+ /**
+ * duke.Command to create a new duke.Event
+ */
+ event,
+ /**
+ * duke.Command to exit the system
+ */
+ bye,
+ /**
+ * duke.Command to delete a duke.Task
+ */
+ delete,
+ /**
+ * duke.Command to mark a task as complete
+ */
+ mark,
+ /**
+ * duke.Command to mark a task as incomplete
+ */
+ unmark,
+ /**
+ * duke.Command to find a task
+ */
+ find,
+ /**
+ * duke.Command to find view schedule
+ */
+ schedule;
+
+ private static DukeException noNumberException = new DukeException("Sorry, no number was detected");
+
+ /**
+ * Execute the exit command and end the program.
+ */
+ public static String exit() {
+ return "Bye. Hope to see you again soon!";
+ }
+
+ /**
+ * Execute the command to list all available tasks.
+ *
+ * @param allTasks the list to store all tasks created by the user
+ */
+ public static String listTasks(AllTasksList allTasks) {
+ return allTasks.listAllTasks();
+ }
+
+ /**
+ * Execute the command to list the schedule of a given date
+ *
+ * @param allTask the list to store all tasks created by the user
+ * @param commandArray a string array of commands to be parsed for more information
+ * @return a string of all deadlines with this due date
+ * @throws DukeException if the due date is malformed
+ */
+ public static String getSchedule(String[] commandArray, AllTasksList allTask) throws DukeException {
+ String dueDate = commandArray[1].trim();
+ return allTask.listSchedule(dueDate);
+ }
+
+ /**
+ * Execute the command to chat with the user.
+ *
+ * @param userInput the scanner object to get user input.
+ * @param allTasks the list to store all tasks created by the user.
+ * @return the response from the bot
+ */
+ public static String chat(String userInput, AllTasksList allTasks) {
+ String botOutput = "";
+ try {
+ botOutput = Command.parseAndExecuteCommand(userInput, allTasks);
+ Storage.storeTasks(allTasks);
+ } catch (DukeException e) {
+ botOutput = e.getMessage();
+ } finally {
+ return botOutput;
+ }
+ }
+
+ /**
+ * Execute the command to mark a task as complete.
+ *
+ * @param commandArray a string array of commands to be parsed for more information
+ * @param allTasks the list to store all tasks created by the user
+ * @throws DukeException
+ */
+ public static String markTask(String[] commandArray, AllTasksList allTasks) throws DukeException {
+ try {
+ if (commandArray.length <= 1) {
+ throw noNumberException;
+ }
+
+ int index = Integer.parseInt(commandArray[1]) - 1;
+ return allTasks.markTask(index);
+ } catch (NumberFormatException e) {
+ throw noNumberException;
+ }
+ }
+
+ /**
+ * Execute the command to mark a task as incomplete.
+ *
+ * @param commandArray a string array of commands to be parsed for more information
+ * @param allTasks the list to store all tasks created by the user
+ * @throws DukeException
+ */
+ public static String unMarkTask(String[] commandArray, AllTasksList allTasks)
+ throws DukeException {
+ try {
+ if (commandArray.length <= 1) {
+ throw noNumberException;
+ }
+
+ int index = Integer.parseInt(commandArray[1]) - 1;
+ return allTasks.unMarkTask(index);
+ } catch (NumberFormatException e) {
+ throw noNumberException;
+ }
+ }
+
+ /**
+ * Execute the command to delete a task.
+ *
+ * @param commandArray a string array of commands to be parsed for more information
+ * @param allTasks the list to store all tasks created by the user
+ * @throws DukeException
+ */
+ public static String delete(String[] commandArray, AllTasksList allTasks) throws DukeException {
+ try {
+ if (commandArray.length <= 1) {
+ throw noNumberException;
+ }
+
+ int index = Integer.parseInt(commandArray[1]) - 1;
+ return allTasks.delete(index);
+ } catch (NumberFormatException e) {
+ throw noNumberException;
+ }
+ }
+
+ /**
+ * utility method used to parse the and execute the user command.
+ *
+ * @param userInput the raw input string the user entered into the chatbot
+ * @param allTasks the Object storing all the tasks created by the user
+ * @throws DukeException
+ * @throws NumberFormatException
+ */
+ public static String parseAndExecuteCommand(String userInput, AllTasksList allTasks) throws DukeException {
+ String[] commandArray = userInput.split(" ", 2);
+ assert commandArray.length <= 2 : "command array should be at most 2 in length";
+ String command = commandArray[0];
+ try {
+ switch (Command.valueOf(command)) {
+ case bye:
+ return Command.exit();
+ case list:
+ return Command.listTasks(allTasks);
+ case find:
+ return allTasks.find(commandArray[1]);
+ case mark:
+ return Command.markTask(commandArray, allTasks);
+ case unmark:
+ return Command.unMarkTask(commandArray, allTasks);
+ case delete:
+ return Command.delete(commandArray, allTasks);
+ case schedule:
+ return Command.getSchedule(commandArray, allTasks);
+ default:
+ Task newTask = Task.createTask(commandArray);
+ return allTasks.addTask(newTask);
+ }
+ } catch (IllegalArgumentException e) {
+ throw new DukeException();
+ }
+ }
+}
diff --git a/src/main/java/duke/Deadline.java b/src/main/java/duke/Deadline.java
new file mode 100644
index 0000000000..317abeabca
--- /dev/null
+++ b/src/main/java/duke/Deadline.java
@@ -0,0 +1,53 @@
+package duke;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+
+/**
+ * A task that also has a deadline
+ *
+ * @author Cui Shen Yi
+ * @version CS2103T AY22/23 Semester 1
+ */
+public class Deadline extends Task {
+ private LocalDateTime dueDate;
+
+ /**
+ * Constructor to create a new duke.Deadline
+ *
+ * @param task the task that you want to complete (String)
+ * @param dueDate the dueDate for this deadline (String)
+ */
+ public Deadline(String task, String dueDate) throws DukeException {
+ super(task);
+ try {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
+ this.dueDate = LocalDateTime.parse(dueDate, formatter);
+ } catch (DateTimeParseException e) {
+ throw new DukeException("Date Format Incorrect: yyyy-MM-dd HH:mm");
+ }
+ }
+
+ /**
+ * Method that checks if a given deadline is the same day as the current task.
+ *
+ * @param date the date to compare to.
+ * @return true if the dates are the same.
+ */
+ public Boolean isSameDay(LocalDateTime date) {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM dd yyyy");
+ return this.dueDate.format(formatter).equals(date.format(formatter));
+ }
+
+ /**
+ * To String method that returns the task in string form to the user
+ *
+ * @return the task in string format
+ */
+ @Override
+ public String toString() {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM dd yyyy HH:mm");
+ return "[D] " + super.toString() + " (by: " + this.dueDate.format(formatter) + ")";
+ }
+}
diff --git a/src/main/java/duke/DukeException.java b/src/main/java/duke/DukeException.java
new file mode 100644
index 0000000000..658cc6b641
--- /dev/null
+++ b/src/main/java/duke/DukeException.java
@@ -0,0 +1,18 @@
+package duke;
+
+/**
+ * A custom exception thrown by Duke
+ *
+ * @author Cui Shen Yi
+ * @version CS2103T AY22/23 Semester 1
+ */
+public class DukeException extends Exception {
+
+ public DukeException() {
+ super("☹ OOPS!!! I'm sorry, but I don't know what that means :-(");
+ }
+
+ public DukeException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/duke/Event.java b/src/main/java/duke/Event.java
new file mode 100644
index 0000000000..8185966515
--- /dev/null
+++ b/src/main/java/duke/Event.java
@@ -0,0 +1,35 @@
+package duke;
+
+import java.io.Serializable;
+
+/**
+ * A task that has a start and end date
+ *
+ * @author Cui Shen Yi
+ * @version CS2103T AY22/23 Semester 1
+ */
+public class Event extends Task implements Serializable {
+
+ private String eventTime;
+
+ /**
+ * Constructor to create a new duke.Event
+ *
+ * @param task the task that you want to complete (String)
+ * @param eventTime the time range for this event (String)
+ */
+ public Event(String task, String eventTime) {
+ super(task);
+ this.eventTime = eventTime;
+ }
+
+ /**
+ * To String method that returns the task in string form to the user
+ *
+ * @return the task in string format
+ */
+ @Override
+ public String toString() {
+ return "[E] " + super.toString() + " (at: " + this.eventTime + ")";
+ }
+}
diff --git a/src/main/java/duke/Storage.java b/src/main/java/duke/Storage.java
new file mode 100644
index 0000000000..fb4a27bddb
--- /dev/null
+++ b/src/main/java/duke/Storage.java
@@ -0,0 +1,86 @@
+package duke;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * Class used to store and load all your tasks from your local storage.
+ *
+ * @author Cui Shen Yi
+ * @version CS2103T AY22/23 Semester 1
+ */
+public class Storage {
+ private static final String STORAGE_PATH = "storage/storage.txt";
+
+ /**
+ * Method used to init the duke.Storage on a device, creating the directory and file if it doesn't exist.
+ */
+ public static void initStorage() {
+ try {
+ Path filePath = Paths.get(Storage.STORAGE_PATH);
+ if (Files.exists(filePath)) {
+ return;
+ }
+ File newFile = new File(Storage.STORAGE_PATH);
+ newFile.getParentFile().mkdir();
+ newFile.createNewFile();
+ AllTasksList allTasks = new AllTasksList();
+ Storage.storeTasks(allTasks);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Method used to store tasks to the device local storage.
+ *
+ * @param allTasks the list of tasks to be saved
+ */
+ public static void storeTasks(AllTasksList allTasks) {
+ try {
+ FileOutputStream fileOut = new FileOutputStream(Storage.STORAGE_PATH);
+ ObjectOutputStream out = new ObjectOutputStream(fileOut);
+ out.writeObject(allTasks);
+ out.close();
+ fileOut.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Method used to retrieve the tasks stored on the device.
+ *
+ * @return the list of tasks saved on the device
+ */
+ public static AllTasksList loadTasks() {
+ AllTasksList allTasks = null;
+ try {
+ FileInputStream fileIn = new FileInputStream(Storage.STORAGE_PATH);
+ ObjectInputStream in = new ObjectInputStream(fileIn);
+ allTasks = (AllTasksList) in.readObject();
+ in.close();
+ fileIn.close();
+ return allTasks;
+ } catch (FileNotFoundException e) {
+ System.out.println("duke storage file not found!");
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ } finally {
+ if (allTasks == null) {
+ allTasks = new AllTasksList();
+ }
+ return allTasks;
+ }
+ }
+}
diff --git a/src/main/java/duke/Task.java b/src/main/java/duke/Task.java
new file mode 100644
index 0000000000..2616f0632f
--- /dev/null
+++ b/src/main/java/duke/Task.java
@@ -0,0 +1,125 @@
+package duke;
+
+import java.io.Serializable;
+
+/**
+ * Abstract super class of all Tasks.
+ *
+ * @author Cui Shen Yi
+ * @version CS2103T AY22/23 Semester 1
+ */
+public abstract class Task implements Serializable {
+
+ protected String task;
+ protected boolean isComplete = false;
+
+ /**
+ * Constructor to create new duke.Task class.
+ *
+ * @param task
+ */
+ protected Task(String task) {
+ this.task = task;
+ }
+
+ /**
+ * Method used get the date and task from a command.
+ *
+ * @param command the string containing the task and date entered by user
+ * @return a string array, pos 0 refers to task pos 1 refers to date
+ */
+ private static String[] getTaskAndDate(String command, String split) {
+ String task = command.split(split, 2)[0].trim();
+ String date = command.split(split, 2)[1].trim();
+
+ return new String[]{ task, date };
+ }
+
+ /**
+ * Factory method used to create a new duke.Task.
+ *
+ * @param commandArray the command entered by the user to be parsed by the method
+ * @return a duke.Task obj, either a duke.Todo, duke.Deadline or duke.Event
+ * @throws DukeException
+ */
+ public static Task createTask(String[] commandArray) throws DukeException {
+ String task;
+ String date;
+ String command = commandArray[0];
+ try {
+ switch (Command.valueOf(command)) {
+ case todo:
+ Task.validateTaskCreation(commandArray, TaskType.TODO);
+ task = commandArray[1].trim();
+ return new Todo(task);
+ case deadline:
+ Task.validateTaskCreation(commandArray, TaskType.DEADLINE);
+ task = Task.getTaskAndDate(commandArray[1], "/by")[0];
+ date = Task.getTaskAndDate(commandArray[1], "/by")[1];
+ return new Deadline(task, date);
+ case event:
+ Task.validateTaskCreation(commandArray, TaskType.EVENT);
+ task = Task.getTaskAndDate(commandArray[1], "/at")[0];
+ date = Task.getTaskAndDate(commandArray[1], "/at")[1];
+ return new Event(task, date);
+ default:
+ throw new DukeException();
+ }
+ } catch (IllegalArgumentException e) {
+ throw new DukeException();
+ }
+ }
+
+ /**
+ * Method used to mark this task as complete.
+ */
+ public String markAsDone() {
+ this.isComplete = true;
+ String output = "\nNice! I've marked this task as done:\n" + this;
+ return output;
+ }
+
+ /**
+ * Method used to mark this task as incomplete
+ */
+ public String unmark() {
+ this.isComplete = false;
+ String output = "\nOK, I've marked this task as not done yet:\n" + this;
+ return output;
+ }
+
+ /**
+ * To String method that returns the task in string form to the user
+ *
+ * @return the task in string format
+ */
+ @Override
+ public String toString() {
+ String checkBox = this.isComplete ? "[X] " : "[ ] ";
+ return checkBox + this.task;
+ }
+
+ /**
+ * A method used to validate a userCommand to for a specific task type.
+ *
+ * @param commandArray the command entered by the user to be parsed by the method
+ * @param taskType the task type either duke.Todo, duke.Deadline or duke.Event
+ * @throws DukeException
+ */
+ private static void validateTaskCreation(String[] commandArray, TaskType taskType) throws DukeException {
+ Boolean isEmptyDescription = commandArray.length <= 1 || commandArray[1].length() == 0;
+ if (isEmptyDescription) {
+ throw new DukeException("☹ OOPS!!! The description of a " + taskType + " cannot be empty.");
+ }
+
+ Boolean isValidDeadline = taskType == TaskType.DEADLINE && commandArray[1].indexOf("/by") < 0;
+ if (isValidDeadline) {
+ throw new DukeException("☹ OOPS!!! The description of a DEADLINE must contain a '/by'");
+ }
+
+ Boolean isValidEvent = taskType == TaskType.EVENT && commandArray[1].indexOf("/at") < 0;
+ if (isValidEvent) {
+ throw new DukeException("☹ OOPS!!! The description of a EVENT must contain a '/at'");
+ }
+ }
+}
diff --git a/src/main/java/duke/TaskTest.java b/src/main/java/duke/TaskTest.java
new file mode 100644
index 0000000000..41c4625c0d
--- /dev/null
+++ b/src/main/java/duke/TaskTest.java
@@ -0,0 +1,34 @@
+package duke;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.Test;
+
+
+public class TaskTest {
+ @Test
+ public void test_create_todo() {
+ try {
+ String[] arr = new String[]{ "todo", "test" };
+ Task todoOne = Task.createTask(arr);
+ Task todoTwo = new Todo("test");
+ assertEquals(todoOne.toString(), todoTwo.toString());
+ } catch (DukeException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ @Test
+ public void test_mark_todo() {
+ try {
+ String[] arr = new String[]{ "todo", "test" };
+ Task todoOne = Task.createTask(arr);
+ todoOne.markAsDone();
+ Task todoTwo = new Todo("test");
+ todoTwo.markAsDone();
+ assertEquals(todoOne.toString(), todoTwo.toString());
+ } catch (DukeException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/duke/TaskType.java b/src/main/java/duke/TaskType.java
new file mode 100644
index 0000000000..57bfab4a2f
--- /dev/null
+++ b/src/main/java/duke/TaskType.java
@@ -0,0 +1,13 @@
+package duke;
+
+/**
+ * Enum class used to store the different type of task flags.
+ *
+ * @author Cui Shen Yi
+ * @version CS2103T AY22/23 Semester 1
+ */
+public enum TaskType {
+ TODO,
+ EVENT,
+ DEADLINE,
+}
diff --git a/src/main/java/duke/Todo.java b/src/main/java/duke/Todo.java
new file mode 100644
index 0000000000..b24c070ad7
--- /dev/null
+++ b/src/main/java/duke/Todo.java
@@ -0,0 +1,31 @@
+package duke;
+
+import java.io.Serializable;
+
+/**
+ * A basic task with no added features.
+ *
+ * @author Cui Shen Yi
+ * @version CS2103T AY22/23 Semester 1
+ */
+public class Todo extends Task implements Serializable {
+
+ /**
+ * Constructor to create a new duke.Deadline
+ *
+ * @param task the task that you want to complete (String)
+ */
+ public Todo(String task) {
+ super(task);
+ }
+
+ /**
+ * To String method that returns the task in string form to the user
+ *
+ * @return the task in string format
+ */
+ @Override
+ public String toString() {
+ return "[T] " + super.toString();
+ }
+}
diff --git a/src/main/resources/images/DaDuke.png b/src/main/resources/images/DaDuke.png
new file mode 100644
index 0000000000..eee27edc88
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..12e01edd84
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..435f3ce0d8
--- /dev/null
+++ b/src/main/resources/view/MainWindow.fxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/storage/storage.txt b/storage/storage.txt
new file mode 100644
index 0000000000..75f9c135e1
Binary files /dev/null and b/storage/storage.txt differ
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 657e74f6e7..4646f5c038 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -5,3 +5,140 @@ Hello from
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
+What can I do for you?
+------------------------------
+:
+Got it. I've added this task:
+[T] [ ] Wash laundry
+------------------------------
+
+------------------------------
+:
+Got it. I've added this task:
+[D] [ ] CS2103T project (by: tomorrow!)
+------------------------------
+
+------------------------------
+:
+Got it. I've added this task:
+[E] [ ] fight someone (at: 27 July 1800 - 2000)
+------------------------------
+
+------------------------------
+:
+1. [T] [ ] Wash laundry
+2. [D] [ ] CS2103T project (by: tomorrow!)
+3. [E] [ ] fight someone (at: 27 July 1800 - 2000)
+------------------------------
+
+------------------------------
+: Nice! I've marked this task as done:
+[T] [X] Wash laundry
+------------------------------
+
+------------------------------
+: Nice! I've marked this task as done:
+[D] [X] CS2103T project (by: tomorrow!)
+------------------------------
+
+------------------------------
+:
+1. [T] [X] Wash laundry
+2. [D] [X] CS2103T project (by: tomorrow!)
+3. [E] [ ] fight someone (at: 27 July 1800 - 2000)
+------------------------------
+
+------------------------------
+: Nice! I've marked this task as done:
+[E] [X] fight someone (at: 27 July 1800 - 2000)
+------------------------------
+
+------------------------------
+: Noted. I've removed this task:
+[T] [X] Wash laundry
+------------------------------
+
+------------------------------
+:
+1. [D] [X] CS2103T project (by: tomorrow!)
+2. [E] [X] fight someone (at: 27 July 1800 - 2000)
+------------------------------
+
+------------------------------
+: No enum constant Commands.idfjiaeiejri
+------------------------------
+
+------------------------------
+: Index 1 out of bounds for length 1
+------------------------------
+
+------------------------------
+: Index 1 out of bounds for length 1
+------------------------------
+
+------------------------------
+: Index 1 out of bounds for length 1
+------------------------------
+
+------------------------------
+: Error: Cannot cast a non-integer into an integer
+------------------------------
+
+------------------------------
+: ☹ OOPS!!! The description of a DEADLINE cannot be empty.
+------------------------------
+
+------------------------------
+: ☹ OOPS!!! The description of a DEADLINE cannot be empty.
+------------------------------
+
+------------------------------
+: ☹ OOPS!!! The description of a TODO cannot be empty.
+------------------------------
+
+------------------------------
+: ☹ OOPS!!! The description of a TODO cannot be empty.
+------------------------------
+
+------------------------------
+: ☹ OOPS!!! The description of a EVENT cannot be empty.
+------------------------------
+
+------------------------------
+: ☹ OOPS!!! The description of a EVENT cannot be empty.
+------------------------------
+
+------------------------------
+:
+Got it. I've added this task:
+[D] [ ] (by: )
+------------------------------
+
+------------------------------
+:
+Got it. I've added this task:
+[E] [ ] (at: )
+------------------------------
+
+------------------------------
+: ☹ OOPS!!! The description of a DEADLINE must contain a '/by'
+------------------------------
+
+------------------------------
+: ☹ OOPS!!! The description of a EVENT must contain a '/at'
+------------------------------
+
+------------------------------
+:
+Got it. I've added this task:
+[E] [ ] (at: 25 July 1000 - 1200)
+------------------------------
+
+------------------------------
+:
+Got it. I've added this task:
+[E] [ ] Drink water (at: )
+------------------------------
+
+------------------------------
+: Bye. Hope to see you again soon!
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index e69de29bb2..fa53f23a97 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -0,0 +1,28 @@
+todo Wash laundry
+deadline CS2103T project /by tomorrow!
+event fight someone /at 27 July 1800 - 2000
+list
+mark 1
+mark 2
+list
+mark 3
+delete 1
+list
+idfjiaeiejri
+mark
+mark
+delete
+delete d
+deadline
+deadline
+todo
+todo
+event
+event
+deadline /by
+event /at
+deadline adsfad
+event adfadf
+event /at 25 July 1000 - 1200
+event Drink water /at
+bye
\ No newline at end of file
diff --git a/text-ui-test/runtest.sh b/text-ui-test/runtest.sh
old mode 100644
new mode 100755