diff --git a/.gitignore b/.gitignore
index f69985ef1f..a730d9d00b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,5 +13,8 @@ src/main/resources/docs/
*.iml
bin/
+# save folder and file name
+src/main/data
+
/text-ui-test/ACTUAL.txt
text-ui-test/EXPECTED-UNIX.TXT
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000000..7f4af6269d
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,70 @@
+plugins {
+ id 'java'
+ id 'application'
+// id 'checkstyle'
+ id 'com.github.johnrengelman.shadow' version '5.1.0'
+}
+
+repositories {
+ mavenCentral()
+}
+
+//java {
+// toolchain {
+// languageVersion = JavaLanguageVersion.of(11)
+// }
+//}
+
+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'
+
+ implementation group: 'org.json', name: 'json', version: '20211205'
+ 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 = "Launcher"
+}
+
+shadowJar {
+ archiveBaseName = "duke"
+ archiveClassifier = null
+}
+
+//checkstyle {
+// toolVersion = '8.29'
+//}
+
+run{
+ standardInput = System.in
+}
+
+
diff --git a/docs/README.md b/docs/README.md
index 8077118ebe..41537573d5 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,29 +1,234 @@
-# User Guide
+# Duked App User Guide
+**Duked App** is a desktop application to manage your tasks efficiently. This application is highly optimized for those who are comfortable using the CLI (typing) in the GUI.
-## Features
+* [Quick start](#quick-start)
+* [Features](#features)
+* [Command summary](#command-summary)
-### Feature-ABC
-Description of the feature.
+## Quick start
+1. Ensure you have Java `11` that supports `JavaFx` or above installed in your
+ computer.
+2. Download the latest `duke.jar` from [here](https://github.com/ThePrevailingOne/ip/releases/tag/BCD-Extension).
+3. Copy the file to the folder you want to use as the
+ *home folder* for your Duke.
+4. Double-click the file to start the app. The GUI
+ similar to the below should appear in a few seconds.
-### Feature-XYZ
+![Duke GUI](Ui.png)
-Description of the feature.
+5. Type the command in the command box and press `Enter/Send` to
+ execute it.
+6. Refer to the [Features](#features) below for details of each
+ command.
-## Usage
-### `Keyword` - Describe action
+## Features
+The app will autosave any changes made to the list of tasks.
-Describe the action and its outcome.
+### Listing all tasks
+List all your tasks available.
+Tasks may include:
+- todos,
+- deadlines,
+- and events.
-Example of usage:
+Command example:
-`keyword (optional arguments)`
+`list`
-Expected outcome:
+Output:
+```
+Here is your current tasks:
+ 1. [T][X] make a todo
+ 2. [E][ ] Do not exist (at: Wednesday, 12 Dec 1212 10:00)
+```
+
+### Add a Todo Task
+Add a Todo Task with description.
+
+Format:
+
+`todo [description]`
+
+Example:
+
+`todo make a todo`
+
+Output:
+```
+Got it. I've added this task:
+ [T][ ] make a todo
+You currently have 12 tasks in the list.
+```
+
+### Add a Deadline Task
+Add a Deadline Task with description and deadline in dd/MM/yyyy HHmm format.
+See [here for more about the date formatting](https://www.baeldung.com/java-datetimeformatter).
+
+Format:
+
+`deadline [description] /by [deadline]`
+
+Example:
+
+`deadline submit assignment /by 20/2/2022 1212`
+
+Output:
+```
+Got it. I've added this task:
+ [D][ ] submit assignment (by: Monday, 20 Feb 2022, 12:12)
+You currently have 12 tasks in the list.
+```
+
+### Add an Event Task
+Add a Deadline Task with description and event time in dd/MM/yyyy HHmm format.
+See [here for more about the date formatting](https://www.baeldung.com/java-datetimeformatter).
+
+Format:
+
+`event [description] /at [event]`
+
+Example:
+
+`event finish hackathon /at 20/2/2022 1212`
+
+Output:
+```
+Got it. I've added this task:
+ [E][ ] finish hackathon (at: Monday, 20 Feb 2022, 12:12)
+You currently have 12 tasks in the list.
+```
+
+### Mark a Task as done
+Mark a task of given the index as done
+Note: Task needs to be set into done manually by user, by giving the Task index. Task index can be obtained through the command `list`.
+
+Format:
+
+`mark [index]`
+
+Example:
+
+`mark 1`
+
+Output:
+```
+Nice! I've marked this task as done:
+ [E][X] finish hackathon (at: Monday, 20 Feb 2022, 12:12)
+```
+
+### Unmark a Task as not done
+Mark a task of given the index as not done
+Note: Task needs to be set into not done manually by user, by giving the Task index. Task index can be obtained through the command `list`.
+
+Format:
+
+`unmark [index]`
+
+Example:
-Description of the outcome.
+`unmark 1`
+Output:
```
-expected output
+Nice! I've marked this task as not done:
+ [E][ ] finish hackathon (at: Monday, 20 Feb 2022, 12:12)
```
+
+### Delete a Task
+Delete a task given the index. Task index can be obtained through the command `list`.
+
+Format:
+
+`delete [index]`
+
+Example:
+
+`delete 1`
+
+Output:
+```
+Got it. I've removed this task:
+ [T][X] Submit CS2103 Assignment
+```
+### Sorting the tasks
+Display a sorted list of the tasks alphabetically by their description.
+
+Format:
+
+`sort`
+
+Example:
+
+`sort`
+
+Output:
+```
+Here are the sorted tasks:
+ 1. [T][X] Procrastinate CS2103 Assignment
+ 2. [T][X] Submit CS2103 Assignment
+You have 12 sorted results.
+```
+### Sorting the deadlines
+Display a sorted list of the deadlines by their deadlines from the earliest.
+
+Format:
+
+`sortdeadline`
+
+Example:
+
+`sortdeadline`
+
+Output:
+```
+Here are the sorted tasks:
+ 1. [D][X] Procrastinate CS2103 Assignment (by: Monday, 20 Feb 2022, 12:12)
+ 2. [D][X] Submit CS2103 Assignment (by: Tuesday, 21 Feb 2022, 12:12)
+You have 2 sorted results.
+```
+
+### Sorting the events
+Display a sorted list of the events by their event time from the earliest.
+
+Format:
+
+`sortevent`
+
+Example:
+
+`sortevent`
+
+Output:
+```
+Here are the sorted tasks:
+ 1. [E][X] Procrastinate CS2103 Assignment (at: Monday, 20 Feb 2022, 12:12)
+ 2. [E][X] Submit CS2103 Assignment (at: Tuesday, 21 Feb 2022, 12:12)
+You have 2 sorted results.
+```
+
+### Exiting the application
+Terminate Duked App.
+
+Example:
+
+`bye`
+
+Output:
+```
+Bye. Hope to see you again soon!
+```
+
+## Command summary
+
+| action | Format, Examples |
+|----------|---------------------------------------------------------------------------------------------------|
+| list | `list` |
+| deadline | `deadline [description] /by [deadline]`
e.g.,`deadline submit cs2103 IP /by 18/2/2022 1212` |
+| event | `event [description] /at [event time]`
e.g.,`event hackathon /at 18/2/2022 1212` |
+| todo | `todo [description]`
e.g.,`todo coding with friends` |
+| delete | `delete [index]`
e.g., `delete 1` |
+| mark | `mark [index]`
e.g., `mark 1` |
+| unmark | `unmark [index]`
e.g., `unmark 1` |
+| bye | `bye` |
diff --git a/docs/Ui.png b/docs/Ui.png
new file mode 100644
index 0000000000..b81f62c036
Binary files /dev/null and b/docs/Ui.png differ
diff --git a/docs/_config.yml b/docs/_config.yml
new file mode 100644
index 0000000000..c4192631f2
--- /dev/null
+++ b/docs/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-cayman
\ No newline at end of file
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..ef9a9e05e4
--- /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-5.6-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/lib/apiguardian-api-1.1.0-javadoc.jar b/lib/apiguardian-api-1.1.0-javadoc.jar
new file mode 100644
index 0000000000..cb8bea036c
Binary files /dev/null and b/lib/apiguardian-api-1.1.0-javadoc.jar differ
diff --git a/lib/apiguardian-api-1.1.0-sources.jar b/lib/apiguardian-api-1.1.0-sources.jar
new file mode 100644
index 0000000000..e1f7ec3b75
Binary files /dev/null and b/lib/apiguardian-api-1.1.0-sources.jar differ
diff --git a/lib/apiguardian-api-1.1.0.jar b/lib/apiguardian-api-1.1.0.jar
new file mode 100644
index 0000000000..e6fcead36f
Binary files /dev/null and b/lib/apiguardian-api-1.1.0.jar differ
diff --git a/lib/json-20211205-javadoc.jar b/lib/json-20211205-javadoc.jar
new file mode 100644
index 0000000000..915da58dff
Binary files /dev/null and b/lib/json-20211205-javadoc.jar differ
diff --git a/lib/json-20211205-sources.jar b/lib/json-20211205-sources.jar
new file mode 100644
index 0000000000..07f04b602e
Binary files /dev/null and b/lib/json-20211205-sources.jar differ
diff --git a/lib/json-20211205.jar b/lib/json-20211205.jar
new file mode 100644
index 0000000000..ee1d0f8c82
Binary files /dev/null and b/lib/json-20211205.jar differ
diff --git a/lib/junit-jupiter-5.6.0-M1-javadoc.jar b/lib/junit-jupiter-5.6.0-M1-javadoc.jar
new file mode 100644
index 0000000000..88927de6fc
Binary files /dev/null and b/lib/junit-jupiter-5.6.0-M1-javadoc.jar differ
diff --git a/lib/junit-jupiter-5.6.0-M1-sources.jar b/lib/junit-jupiter-5.6.0-M1-sources.jar
new file mode 100644
index 0000000000..c5d8377dd9
Binary files /dev/null and b/lib/junit-jupiter-5.6.0-M1-sources.jar differ
diff --git a/lib/junit-jupiter-5.6.0-M1.jar b/lib/junit-jupiter-5.6.0-M1.jar
new file mode 100644
index 0000000000..97ff82a85a
Binary files /dev/null and b/lib/junit-jupiter-5.6.0-M1.jar differ
diff --git a/lib/junit-jupiter-api-5.6.0-M1-javadoc.jar b/lib/junit-jupiter-api-5.6.0-M1-javadoc.jar
new file mode 100644
index 0000000000..505e3a6ca2
Binary files /dev/null and b/lib/junit-jupiter-api-5.6.0-M1-javadoc.jar differ
diff --git a/lib/junit-jupiter-api-5.6.0-M1-sources.jar b/lib/junit-jupiter-api-5.6.0-M1-sources.jar
new file mode 100644
index 0000000000..3775c4ba59
Binary files /dev/null and b/lib/junit-jupiter-api-5.6.0-M1-sources.jar differ
diff --git a/lib/junit-jupiter-api-5.6.0-M1.jar b/lib/junit-jupiter-api-5.6.0-M1.jar
new file mode 100644
index 0000000000..da1f154d72
Binary files /dev/null and b/lib/junit-jupiter-api-5.6.0-M1.jar differ
diff --git a/lib/junit-jupiter-engine-5.6.0-M1-javadoc.jar b/lib/junit-jupiter-engine-5.6.0-M1-javadoc.jar
new file mode 100644
index 0000000000..a589f36da1
Binary files /dev/null and b/lib/junit-jupiter-engine-5.6.0-M1-javadoc.jar differ
diff --git a/lib/junit-jupiter-engine-5.6.0-M1-sources.jar b/lib/junit-jupiter-engine-5.6.0-M1-sources.jar
new file mode 100644
index 0000000000..b3a2a529c2
Binary files /dev/null and b/lib/junit-jupiter-engine-5.6.0-M1-sources.jar differ
diff --git a/lib/junit-jupiter-engine-5.6.0-M1.jar b/lib/junit-jupiter-engine-5.6.0-M1.jar
new file mode 100644
index 0000000000..4465a3920b
Binary files /dev/null and b/lib/junit-jupiter-engine-5.6.0-M1.jar differ
diff --git a/lib/junit-jupiter-params-5.6.0-M1-javadoc.jar b/lib/junit-jupiter-params-5.6.0-M1-javadoc.jar
new file mode 100644
index 0000000000..8cbb390a70
Binary files /dev/null and b/lib/junit-jupiter-params-5.6.0-M1-javadoc.jar differ
diff --git a/lib/junit-jupiter-params-5.6.0-M1-sources.jar b/lib/junit-jupiter-params-5.6.0-M1-sources.jar
new file mode 100644
index 0000000000..37f1bc6981
Binary files /dev/null and b/lib/junit-jupiter-params-5.6.0-M1-sources.jar differ
diff --git a/lib/junit-jupiter-params-5.6.0-M1.jar b/lib/junit-jupiter-params-5.6.0-M1.jar
new file mode 100644
index 0000000000..bef1635a68
Binary files /dev/null and b/lib/junit-jupiter-params-5.6.0-M1.jar differ
diff --git a/lib/junit-platform-commons-1.6.0-M1-javadoc.jar b/lib/junit-platform-commons-1.6.0-M1-javadoc.jar
new file mode 100644
index 0000000000..a4cf6879da
Binary files /dev/null and b/lib/junit-platform-commons-1.6.0-M1-javadoc.jar differ
diff --git a/lib/junit-platform-commons-1.6.0-M1-sources.jar b/lib/junit-platform-commons-1.6.0-M1-sources.jar
new file mode 100644
index 0000000000..eade537cae
Binary files /dev/null and b/lib/junit-platform-commons-1.6.0-M1-sources.jar differ
diff --git a/lib/junit-platform-commons-1.6.0-M1.jar b/lib/junit-platform-commons-1.6.0-M1.jar
new file mode 100644
index 0000000000..e736dce8a1
Binary files /dev/null and b/lib/junit-platform-commons-1.6.0-M1.jar differ
diff --git a/lib/junit-platform-engine-1.6.0-M1-javadoc.jar b/lib/junit-platform-engine-1.6.0-M1-javadoc.jar
new file mode 100644
index 0000000000..775b6051e0
Binary files /dev/null and b/lib/junit-platform-engine-1.6.0-M1-javadoc.jar differ
diff --git a/lib/junit-platform-engine-1.6.0-M1-sources.jar b/lib/junit-platform-engine-1.6.0-M1-sources.jar
new file mode 100644
index 0000000000..0da8bd4241
Binary files /dev/null and b/lib/junit-platform-engine-1.6.0-M1-sources.jar differ
diff --git a/lib/junit-platform-engine-1.6.0-M1.jar b/lib/junit-platform-engine-1.6.0-M1.jar
new file mode 100644
index 0000000000..f4a6ba71e2
Binary files /dev/null and b/lib/junit-platform-engine-1.6.0-M1.jar differ
diff --git a/lib/opentest4j-1.2.0-javadoc.jar b/lib/opentest4j-1.2.0-javadoc.jar
new file mode 100644
index 0000000000..def7098e5a
Binary files /dev/null and b/lib/opentest4j-1.2.0-javadoc.jar differ
diff --git a/lib/opentest4j-1.2.0-sources.jar b/lib/opentest4j-1.2.0-sources.jar
new file mode 100644
index 0000000000..9f78a329b8
Binary files /dev/null and b/lib/opentest4j-1.2.0-sources.jar differ
diff --git a/lib/opentest4j-1.2.0.jar b/lib/opentest4j-1.2.0.jar
new file mode 100644
index 0000000000..d5006361a4
Binary files /dev/null and b/lib/opentest4j-1.2.0.jar differ
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/Launcher.java b/src/main/java/Launcher.java
new file mode 100644
index 0000000000..e37ab52cb5
--- /dev/null
+++ b/src/main/java/Launcher.java
@@ -0,0 +1,11 @@
+import javafx.application.Application;
+import duke.Main;
+
+/**
+ * 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/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..d2ffd5b4d2
--- /dev/null
+++ b/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Duke
+
diff --git a/src/main/java/duke/DialogBox.java b/src/main/java/duke/DialogBox.java
new file mode 100644
index 0000000000..3ed1b8d26a
--- /dev/null
+++ b/src/main/java/duke/DialogBox.java
@@ -0,0 +1,65 @@
+package duke;
+
+import duke.controller.MainWindow;
+
+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;
+import javafx.scene.layout.Region;
+
+/**
+ * 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.dialog.setStyle(db.dialog.getStyle() + "-fx-translate-x: 10; -fx-background-color: #B3E5FC");
+ db.flip();
+ return db;
+ }
+}
diff --git a/src/main/java/duke/Duke.java b/src/main/java/duke/Duke.java
new file mode 100644
index 0000000000..6a3d6be672
--- /dev/null
+++ b/src/main/java/duke/Duke.java
@@ -0,0 +1,178 @@
+package duke;
+
+import duke.managers.DateTimeManager;
+import duke.parsers.InputParser;
+import duke.parsers.InputType;
+import duke.exceptions.EmptyDescriptionException;
+import duke.exceptions.EmptyInputException;
+import duke.managers.JSONFileManager;
+import duke.tasks.WordList;
+import duke.tasks.WordListItem;
+import duke.ui.DukeUI;
+
+import java.util.Scanner;
+
+/**
+ * Duke is an app made for users with some technical background to manage their tasks.
+ * Duke is highly customized for those used to the CLI.
+ */
+public class Duke {
+ private static final String BYE_MESSAGE = "Bye. Hope to see you again soon!";
+ private static final String ERROR_MESSAGE_PREFIX = "Oh no! Duke is encountering a problem :(\n";
+ private static final String WELCOME_MESSAGE = "Hello! I'm Duked \nWhat can I do for you?";
+ private WordList wordList;
+ private JSONFileManager jsonFileManager;
+ private DukeUI ui;
+
+ /**
+ * Constructs the app Duke with default settings.
+ */
+ public Duke() {
+ this.ui = new DukeUI(new Scanner(System.in));
+ this.jsonFileManager = new JSONFileManager();
+ this.jsonFileManager.setUpSaveSystem();
+ this.wordList = this.jsonFileManager.loadListFromJSONFile();
+ }
+
+ /**
+ * Construct the app Duke with the given storagePath and storageFileName.
+ * @param storagePath string of storage path
+ * @param storageFileName string of storage file name (with .json extension)
+ */
+ public Duke(String storagePath, String storageFileName) {
+ this.ui = new DukeUI(new Scanner(System.in));
+ this.jsonFileManager = new JSONFileManager(storagePath, storageFileName);
+ this.jsonFileManager.setUpSaveSystem();
+ this.wordList = this.jsonFileManager.loadListFromJSONFile();
+ }
+
+ /**
+ * Runs the Duke app.
+ * Handles the logic and processes of the app.
+ */
+ public void run() {
+ this.ui.replyWelcomeMessage();
+ String input;
+
+ while (true) {
+ try {
+ input = this.ui.waitForinput();
+ checkEmpty(input);
+ Object[] parseResult = InputParser.parseInput(input);
+ InputType inputType = (InputType) parseResult[0];
+ String[] value = (String[]) parseResult[1];
+
+ processInput(inputType, value);
+ if (inputType == InputType.BYE) {
+ break;
+ }
+ this.jsonFileManager.saveListToJSONFile(wordList);
+ } catch (EmptyInputException e) {
+ this.ui.replyError(e);
+ continue;
+ } catch (EmptyDescriptionException e) {
+ this.ui.replyError(e);
+ } catch (NumberFormatException e) {
+ this.ui.replyError(e);
+ } catch (Exception e) {
+ this.ui.replyError(e);
+ }
+ }
+
+ this.ui.replyBye();
+ }
+
+ /**
+ * initiate Duke.java to start the app.
+ * @param args
+ */
+ public static void main(String[] args) {
+ Duke dukeApp = new Duke("src/data/", "anotherTasks.json");
+ dukeApp.run();
+ }
+
+ /**
+ * Process the input based on the InputType and values given.
+ * @see InputType
+ * @param inputType type of the input
+ * @param value value of the input
+ * @return
+ */
+ public String processInput(InputType inputType, String[] value) {
+ WordListItem wordListItem;
+ WordListItem[] wordListItems;
+ switch(inputType) {
+ case LIST:
+ return wordList.toString();
+ case MARK:
+ return wordList.markItem(Integer.parseInt(value[0]));
+ case UNMARK:
+ return wordList.unmarkItem(Integer.parseInt(value[0]));
+ case FIND:
+ wordListItems = wordList.findItems(value[0]);
+ return ui.displayFoundItem(wordListItems, value[0]);
+ case TODO:
+ wordListItem = wordList.storeTodo(value[0], false);
+ return ui.echoAddedItem(wordListItem, wordList);
+ case DEADLINE:
+ wordListItem = wordList.storeDeadline(value[0], DateTimeManager.parseString(value[1]), false);
+ return ui.echoAddedItem(wordListItem, wordList);
+ case EVENT:
+ wordListItem = wordList.storeEvent(value[0], DateTimeManager.parseString(value[1]), false);
+ return ui.echoAddedItem(wordListItem, wordList);
+ case SORT:
+ System.out.println("HAHA");
+ wordListItems = wordList.sortedItemsByDescription();
+ return ui.displaySortedList(wordListItems);
+ case SORTEVENT:
+ wordListItems = wordList.sortedEvents();
+ return ui.displaySortedList(wordListItems);
+ case SORTDEADLINE:
+ wordListItems = wordList.sortedDeadlines();
+ System.out.println(wordListItems.length);
+ return ui.displaySortedList(wordListItems);
+ case BYE:
+ return BYE_MESSAGE;
+ case DELETE:
+ wordListItem = wordList.removeItem(Integer.parseInt(value[0]));
+ return ui.echoRemovedItem(wordListItem, wordList);
+ case NONE:
+ break;
+ }
+ return "Something is wrong with Duke :O!!";
+ }
+
+ public String getWelcomeMessage() {
+ return WELCOME_MESSAGE;
+ }
+
+ public String getResponse(String userInput) {
+ String properResponse = "";
+ try {
+ checkEmpty(userInput);
+ Object[] parseResult = InputParser.parseInput(userInput);
+ InputType inputType = (InputType) parseResult[0];
+ String[] value = (String[]) parseResult[1];
+
+ properResponse = processInput(inputType, value);
+ if (inputType == InputType.BYE) {
+ return BYE_MESSAGE;
+ }
+ this.jsonFileManager.saveListToJSONFile(wordList);
+ } catch (Exception e) {
+ return ERROR_MESSAGE_PREFIX + e.getMessage();
+ }
+ return properResponse;
+ }
+
+ public boolean isByeMessage(String response) {
+ return BYE_MESSAGE.equals(response);
+ }
+
+ private static void checkEmpty(String input) throws EmptyInputException {
+ if (input.isEmpty()) {
+ throw new EmptyInputException("Input cannot be empty!");
+ }
+ }
+}
+
diff --git a/src/main/java/duke/Main.java b/src/main/java/duke/Main.java
new file mode 100644
index 0000000000..3d086b9e76
--- /dev/null
+++ b/src/main/java/duke/Main.java
@@ -0,0 +1,34 @@
+package duke;
+
+import java.io.IOException;
+import duke.controller.MainWindow;
+
+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);
+ stage.setTitle("Duked!");
+ fxmlLoader.getController().setDuke(duke);
+ stage.show();
+ fxmlLoader.getController().welcomeUser();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/duke/controller/MainWindow.java b/src/main/java/duke/controller/MainWindow.java
new file mode 100644
index 0000000000..f19aedf4c2
--- /dev/null
+++ b/src/main/java/duke/controller/MainWindow.java
@@ -0,0 +1,77 @@
+package duke.controller;
+
+import duke.Duke;
+import duke.DialogBox;
+
+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;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * 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.jpeg"));
+ private Image dukeImage = new Image(this.getClass().getResourceAsStream("/images/DaDuke.jpeg"));
+
+ @FXML
+ public void initialize() {
+ scrollPane.vvalueProperty().bind(dialogContainer.heightProperty());
+ }
+
+ public void setDuke(Duke d) {
+ duke = d;
+ }
+
+ public void welcomeUser() {
+ dialogContainer.getChildren().addAll(
+ DialogBox.getDukeDialog(duke.getWelcomeMessage(), 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.isByeMessage(response)) {
+ CompletableFuture.supplyAsync(() -> {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+
+ }
+ Platform.exit();
+ return null;
+ });
+ }
+ }
+}
diff --git a/src/main/java/duke/exceptions/EmptyDescriptionException.java b/src/main/java/duke/exceptions/EmptyDescriptionException.java
new file mode 100644
index 0000000000..cb0e897e5b
--- /dev/null
+++ b/src/main/java/duke/exceptions/EmptyDescriptionException.java
@@ -0,0 +1,14 @@
+package duke.exceptions;
+
+/**
+ * Exception when no description os passed into the input.
+ */
+public class EmptyDescriptionException extends Exception{
+ /**
+ * Construct an EmptyDescriptionException.
+ * @param errorMessage
+ */
+ public EmptyDescriptionException(String errorMessage) {
+ super(errorMessage);
+ }
+}
diff --git a/src/main/java/duke/exceptions/EmptyInputException.java b/src/main/java/duke/exceptions/EmptyInputException.java
new file mode 100644
index 0000000000..091842c9da
--- /dev/null
+++ b/src/main/java/duke/exceptions/EmptyInputException.java
@@ -0,0 +1,14 @@
+package duke.exceptions;
+
+/**
+ * Exception when the input is empty.
+ */
+public class EmptyInputException extends Exception{
+ /**
+ * Construct an EmptyInputException.
+ * @param errorMessage
+ */
+ public EmptyInputException(String errorMessage) {
+ super(errorMessage);
+ }
+}
diff --git a/src/main/java/duke/exceptions/UnknownInputException.java b/src/main/java/duke/exceptions/UnknownInputException.java
new file mode 100644
index 0000000000..35d7c1b6d5
--- /dev/null
+++ b/src/main/java/duke/exceptions/UnknownInputException.java
@@ -0,0 +1,14 @@
+package duke.exceptions;
+
+/**
+ * Exception when the parser fail to parse the input.
+ */
+public class UnknownInputException extends Exception{
+ /**
+ * Construct an UnknownInputException.
+ * @param errorMessage
+ */
+ public UnknownInputException(String errorMessage) {
+ super(errorMessage);
+ }
+}
diff --git a/src/main/java/duke/managers/DateTimeManager.java b/src/main/java/duke/managers/DateTimeManager.java
new file mode 100644
index 0000000000..e218815749
--- /dev/null
+++ b/src/main/java/duke/managers/DateTimeManager.java
@@ -0,0 +1,48 @@
+package duke.managers;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * Manage the conversion and parsing of string into Datetime.
+ * Any conversion of string into Datetime and vice versa should be done via the DateTimeManager.
+ * @see more about the format.
+ */
+public class DateTimeManager {
+ static String localDateTimeFormat = "dd/MM/yyyy HHmm";
+ static String localDateTimeString = "EEEE, dd MMM yyyy HH:mm";
+
+ /**
+ * Parse a string (representing a datetime) to a LocalDateTime. The form of the string needs to be in "dd/MM/yyyy HHmm".
+ * @param dateTimeString a datetime string in form of "dd/MM/yyyy HHmm"
+ * see here for more about the format
+ * @return localDateTime
+ */
+ static public LocalDateTime parseString(String dateTimeString) {
+ DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern(localDateTimeFormat);
+ LocalDateTime localDateTime = LocalDateTime.parse(dateTimeString, inputFormatter);
+ return localDateTime;
+ }
+
+ /**
+ * Get a display string in form of "EEEE, dd MMM yyyy HH:mm" from a LocalDateTime.
+ * @param localDateTime the datetime to be parsed back to a display string
+ * @return displayString in form of "EEEE, dd MMM yyyy HH:mm"
+ * see here for more about the format
+ */
+ static public String getDisplayString(LocalDateTime localDateTime) {
+ DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(localDateTimeString);
+ return localDateTime.format(outputFormatter);
+ }
+
+ /**
+ * Get the unparsed form of the local datetime (getting the original string back).
+ * @param localDateTime the datetime to be parsed back to the original string
+ * @return original string in form of "dd/MM/yyyy HHmm"
+ * see here for more about the format
+ */
+ static public String getOriginalString(LocalDateTime localDateTime) {
+ DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern(localDateTimeFormat);
+ return localDateTime.format(inputFormatter);
+ }
+}
diff --git a/src/main/java/duke/managers/JSONFileManager.java b/src/main/java/duke/managers/JSONFileManager.java
new file mode 100644
index 0000000000..40e4c0d74e
--- /dev/null
+++ b/src/main/java/duke/managers/JSONFileManager.java
@@ -0,0 +1,177 @@
+package duke.managers;
+
+import duke.tasks.Deadline;
+import duke.tasks.Event;
+import duke.tasks.Todo;
+import duke.tasks.WordList;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.LocalDateTime;
+
+/**
+ * Manages the storage system of the app.
+ * Utilizes java.nio and org.json to establish the saving system.
+ * Files are saved in form of json files.
+ */
+public class JSONFileManager {
+ static private final String BASE_PATH = System.getProperty("user.dir");
+ static private final Path SAVE_FOLDER_PATH = Paths.get(BASE_PATH, "src", "main", "data");
+ static private final String FILE_NAME = "tasks.json";
+ static private final Path SAVE_FILE_PATH = SAVE_FOLDER_PATH.resolve(FILE_NAME);
+
+ private final Path saveFolderPath;
+ private final Path saveFilePath;
+
+ /**
+ * Construct a default JSONFileManager
+ */
+ public JSONFileManager() {
+ this.saveFolderPath = SAVE_FOLDER_PATH;
+ this.saveFilePath = SAVE_FILE_PATH;
+ }
+
+ /**
+ * Construct a JSONFileManager with a specified save folder path and save json file.
+ * @param saveFolderPath path to the new save folder
+ * @param jsonFileName name of the new save file
+ */
+ public JSONFileManager(String saveFolderPath, String jsonFileName) {
+ String[] strPaths = saveFolderPath.split("/");
+ this.saveFolderPath = Paths.get(BASE_PATH, strPaths);
+ this.saveFilePath = this.saveFolderPath.resolve(jsonFileName);
+ }
+ private boolean isExistsSaveFolder() {
+ return Files.exists(this.saveFolderPath);
+ }
+
+ private void createSaveFolder() {
+ try {
+ Files.createDirectories(this.saveFolderPath);
+ } catch (IOException e) {
+ System.out.println(e);
+ }
+ }
+
+ private boolean isExistsSaveFile() {
+ return Files.exists(saveFilePath);
+ }
+
+ private void createSaveFile() {
+ try {
+ Files.createFile(saveFilePath);
+ saveListToJSONFile(new WordList());
+ } catch (IOException e) {
+ System.out.println(e);
+ }
+ }
+
+ /**
+ * Set up the save system with the given save folder path and save file name.
+ * @see #JSONFileManager(String, String)
+ */
+ public void setUpSaveSystem() {
+ if (!isExistsSaveFolder()) {
+ createSaveFolder();
+ }
+
+ if (!isExistsSaveFile()) {
+ createSaveFile();
+ }
+ }
+
+ private String readSavedString() {
+ try {
+ String savedString = Files.readString(saveFilePath);
+ return savedString;
+ } catch (IOException e) {
+ System.out.println(e);
+ return "";
+ }
+ }
+
+ private void writeSavedString(String savedString) {
+ try {
+ Files.writeString(saveFilePath, savedString);
+ } catch (IOException e) {
+ System.out.println(e);
+ }
+ }
+
+ private String parseListToJSONString(WordList wordList) {
+ JSONArray jsonArray = new JSONArray();
+
+ wordList.forEach(wordListItem -> {
+ JSONObject itemJSON = new JSONObject();
+ String symbol = wordListItem instanceof Todo
+ ? Todo.getSymbol()
+ : wordListItem instanceof Deadline
+ ? Deadline.getSymbol()
+ : wordListItem instanceof Event
+ ? Event.getSymbol()
+ : null;
+ itemJSON.put("symbol", symbol);
+ itemJSON.put("description", wordListItem.getDescription());
+ itemJSON.put("isDone", wordListItem.getIsDone());
+// System.out.println(itemJSON);
+ if (wordListItem instanceof Deadline) {
+ Deadline deadline = (Deadline) wordListItem;
+ itemJSON.put("datetime", DateTimeManager.getOriginalString(deadline.getDatetime()));
+ }
+ if (wordListItem instanceof Event) {
+ Event deadline = (Event) wordListItem;
+ itemJSON.put("datetime", DateTimeManager.getOriginalString(deadline.getDatetime()));
+ }
+ jsonArray.put(itemJSON);
+ });
+
+ return jsonArray.toString();
+ }
+
+ private WordList parseJSONStringToList(String jsonString) {
+ JSONArray jsonArray = new JSONArray(jsonString);
+ WordList wordList = new WordList();
+ for (int i = 0; i < jsonArray.length(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ String symbol = jsonObject.getString("symbol");
+ if (symbol.equals(Todo.getSymbol())) {
+ String description = jsonObject.getString("description");
+ boolean isDone = jsonObject.getBoolean("isDone");
+ wordList.storeTodo(description, isDone);
+ } else if (symbol.equals(Deadline.getSymbol())) {
+ String description = jsonObject.getString("description");
+ boolean isDone = jsonObject.getBoolean("isDone");
+ String datetimeString = jsonObject.getString("datetime");
+ LocalDateTime datetime = DateTimeManager.parseString(datetimeString);
+ wordList.storeDeadline(description, datetime, isDone);
+ } else if (symbol.equals(Event.getSymbol())) {
+ String description = jsonObject.getString("description");
+ boolean isDone = jsonObject.getBoolean("isDone");
+ String datetimeString = jsonObject.getString("datetime");
+ LocalDateTime datetime = DateTimeManager.parseString(datetimeString);
+ wordList.storeEvent(description, datetime, isDone);
+ }
+ }
+ return wordList;
+ }
+
+ /**
+ * load the list of words from the save file
+ * @return a WordList object consisting of items based on the save file system
+ */
+ public WordList loadListFromJSONFile() {
+ return parseJSONStringToList(readSavedString());
+ }
+
+ /**
+ * save the list of words to the save file in form of json
+ * @param wordList the list of words to be saved to the save file
+ */
+ public void saveListToJSONFile(WordList wordList) {
+ writeSavedString(parseListToJSONString(wordList));
+ }
+}
diff --git a/src/main/java/duke/parsers/InputParser.java b/src/main/java/duke/parsers/InputParser.java
new file mode 100644
index 0000000000..508822a037
--- /dev/null
+++ b/src/main/java/duke/parsers/InputParser.java
@@ -0,0 +1,74 @@
+package duke.parsers;
+
+import duke.exceptions.EmptyDescriptionException;
+import duke.exceptions.UnknownInputException;
+
+import java.util.Arrays;
+
+/**
+ * Handles the parsing of the input.
+ * All input should be parsed via InputParser.
+ */
+public class InputParser {
+ static private final InputType[] ZERO_VALUE_TYPE = new InputType[]{
+ InputType.LIST, InputType.BYE, InputType.SORT, InputType.SORTEVENT, InputType.SORTDEADLINE};
+ static private final InputType[] SINGLE_VALUE_TYPE = new InputType[]{
+ InputType.TODO, InputType.FIND, InputType.MARK, InputType.UNMARK, InputType.DELETE};
+ /**
+ * parse the input of string into an InputType and the values of the input.
+ * @see InputType
+ * @param input the string of input
+ * @return an Object[] where the first element is an InputType and the second element is an array of values.
+ * @throws EmptyDescriptionException
+ * @throws UnknownInputException
+ */
+ static public Object[] parseInput(String input) throws EmptyDescriptionException, UnknownInputException {
+ InputType type = InputType.NONE;
+ String[] value = new String[]{ input };
+ for(InputType inputType: InputType.values()) {
+ if (inputType == InputType.NONE) {
+ continue;
+ }
+
+ if (input.startsWith(inputType.label)) {
+ boolean isZeroValueType = Arrays.stream(ZERO_VALUE_TYPE).anyMatch(x -> x == inputType);
+ if (isZeroValueType) {
+ value = new String[]{};
+ type = inputType;
+ return new Object[]{type, value};
+ }
+
+ boolean isSingleValueType = Arrays.stream(SINGLE_VALUE_TYPE).anyMatch(x -> x == inputType);
+ if (isSingleValueType) {
+ String description = input.substring(inputType.label.length()).trim();
+ if (description.isBlank()) {
+ throw new EmptyDescriptionException("only blank characters found after command :(");
+ }
+ value = new String[]{description};
+ type = inputType;
+ return new Object[]{type, value};
+ }
+
+ if (inputType == InputType.DEADLINE) {
+ int datetimeIndex = input.indexOf("/by");
+ String description = input.substring(inputType.label.length() + 1, datetimeIndex - 1).trim();
+ String datetime = input.substring(datetimeIndex + 4).trim();
+ value = new String[]{description, datetime};
+ type = inputType;
+ return new Object[]{type, value};
+ }
+
+ if (inputType == InputType.EVENT) {
+ int datetimeIndex = input.indexOf("/at");
+ String description = input.substring(inputType.label.length() + 1, datetimeIndex - 1).trim();
+ String datetime = input.substring(datetimeIndex + 4).trim();
+ value = new String[]{description, datetime};
+ type = inputType;
+ return new Object[]{type, value};
+ }
+ }
+ }
+
+ throw new UnknownInputException("Sorry, Duke doesn't know the command: '" + input + "' :(");
+ }
+}
diff --git a/src/main/java/duke/parsers/InputType.java b/src/main/java/duke/parsers/InputType.java
new file mode 100644
index 0000000000..5dc87b3f7a
--- /dev/null
+++ b/src/main/java/duke/parsers/InputType.java
@@ -0,0 +1,27 @@
+package duke.parsers;
+
+/**
+ * Defines the types of inputs as well as the labels representing it.
+ */
+public enum InputType {
+ BYE("bye"),
+ LIST("list"),
+ DEADLINE("deadline"),
+ EVENT("event"),
+ TODO("todo"),
+ MARK("mark"),
+ UNMARK("unmark"),
+ FIND("find"),
+ DELETE("delete"),
+ SORTDEADLINE("sortdeadline"),
+ SORTEVENT("sortevent"),
+ SORT("sort"),
+ NONE("none");
+
+ public final String label;
+
+ private InputType(String label) {
+ this.label = label;
+ }
+
+}
diff --git a/src/main/java/duke/tasks/Deadline.java b/src/main/java/duke/tasks/Deadline.java
new file mode 100644
index 0000000000..c6e826b6ec
--- /dev/null
+++ b/src/main/java/duke/tasks/Deadline.java
@@ -0,0 +1,46 @@
+package duke.tasks;
+
+import duke.managers.DateTimeManager;
+
+import java.time.LocalDateTime;
+
+/**
+ * A type of task which has a deadline set to it.
+ * The deadline is in form of datetime and is symbolized with "[D]".
+ */
+public class Deadline extends WordListItem {
+ static private final String SYMBOL = "[D]";
+ private LocalDateTime datetime;
+
+ /**
+ * Constructor for deadline.
+ * @param description description of the deadline
+ * @param datetime datetime for the deadline
+ */
+ public Deadline(String description, LocalDateTime datetime) {
+ super(description);
+ this.datetime = datetime;
+ }
+
+ /**
+ * Get the datetime of the deadline.
+ * @return datetime
+ */
+ public LocalDateTime getDatetime() {
+ return this.datetime;
+ }
+
+ /**
+ * Get the symbol for the deadline.
+ * @return symbol
+ */
+ static public String getSymbol() {
+ return SYMBOL;
+ }
+
+ @Override
+ public String toString() {
+ String datetimestr = DateTimeManager.getDisplayString(this.datetime);
+ return SYMBOL + super.toString() + " (by: " + datetimestr + ")";
+ }
+}
diff --git a/src/main/java/duke/tasks/Event.java b/src/main/java/duke/tasks/Event.java
new file mode 100644
index 0000000000..f7a4776e5d
--- /dev/null
+++ b/src/main/java/duke/tasks/Event.java
@@ -0,0 +1,46 @@
+package duke.tasks;
+
+import duke.managers.DateTimeManager;
+
+import java.time.LocalDateTime;
+
+/**
+ * A type of task which has a date and time of the event set to it.
+ * The date and time of the event is in form of datetime and is symbolized with "[E]".
+ */
+public class Event extends WordListItem {
+ static private final String SYMBOL = "[E]";
+ private LocalDateTime datetime;
+
+ /**
+ * Constructor for event.
+ * @param description description of the event
+ * @param datetime datetime for the event
+ */
+ public Event(String description, LocalDateTime datetime) {
+ super(description);
+ this.datetime = datetime;
+ }
+
+ /**
+ * Get the datetime of the deadline.
+ * @return datetime
+ */
+ public LocalDateTime getDatetime() {
+ return this.datetime;
+ }
+
+ /**
+ * Get the symbol for the deadline.
+ * @return symbol
+ */
+ static public String getSymbol() {
+ return SYMBOL;
+ }
+
+ @Override
+ public String toString() {
+ String datetimestr = DateTimeManager.getDisplayString(this.datetime);
+ return SYMBOL + super.toString() + " (at: " + datetimestr + ")";
+ }
+}
diff --git a/src/main/java/duke/tasks/Todo.java b/src/main/java/duke/tasks/Todo.java
new file mode 100644
index 0000000000..015ca97eaf
--- /dev/null
+++ b/src/main/java/duke/tasks/Todo.java
@@ -0,0 +1,30 @@
+package duke.tasks;
+
+/**
+ * A type of task.
+ * The most generic type of task and is symbolized with "[T]".
+ */
+public class Todo extends WordListItem {
+ static private final String SYMBOL = "[T]";
+
+ /**
+ * Constructor for todo.
+ * @param description description of the event
+ */
+ public Todo(String description) {
+ super(description);
+ }
+
+ /**
+ * Get the symbol for the todo.
+ * @return symbol
+ */
+ static public String getSymbol() {
+ return SYMBOL;
+ }
+
+ @Override
+ public String toString() {
+ return SYMBOL + super.toString();
+ }
+}
diff --git a/src/main/java/duke/tasks/WordList.java b/src/main/java/duke/tasks/WordList.java
new file mode 100644
index 0000000000..f50eac99c5
--- /dev/null
+++ b/src/main/java/duke/tasks/WordList.java
@@ -0,0 +1,168 @@
+package duke.tasks;
+
+import duke.tasks.Deadline;
+import duke.tasks.Event;
+import duke.tasks.Todo;
+import duke.tasks.WordListItem;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.function.Consumer;
+
+/**
+ * An object storing the list of words/tasks.
+ * WordList is able to store, remove, and find items.
+ * WordList can also be iterated through using forEach()
+ * @see #forEach(Consumer)
+ */
+public class WordList {
+ private ArrayList wordList;
+
+ /**
+ * Construct an empty WordList.
+ */
+ public WordList() {
+ this.wordList = new ArrayList<>();
+ }
+
+ /**
+ * Store a todo into the wordlist. Also returns the todo as well.
+ * @see Todo
+ * @param word description of the task.
+ * @param isDone status of the task.
+ * @return Todo object
+ */
+ public Todo storeTodo(String word, boolean isDone) {
+ Todo todo = new Todo(word);
+ if (isDone) {
+ todo.markItem();
+ }
+ this.wordList.add(todo);
+ return todo;
+ }
+
+ /**
+ * Store a deadline into the wordlist. Also returns the deadline as well.
+ * @see Deadline
+ * @param word description of the task.
+ * @param datetime datetime of the task.
+ * @param isDone status of the task.
+ * @return Deadline object
+ */
+ public Deadline storeDeadline(String word, LocalDateTime datetime, boolean isDone) {
+ Deadline deadline = new Deadline(word, datetime);
+ if (isDone) {
+ deadline.markItem();
+ }
+ this.wordList.add(deadline);
+ return deadline;
+ }
+
+ /**
+ * Store a event into the wordlist. Also returns the event as well.
+ * @see Event
+ * @param word description of the task.
+ * @param datetime datetime of the task.
+ * @param isDone status of the task.
+ * @return Event object
+ */
+ public Event storeEvent(String word, LocalDateTime datetime, boolean isDone) {
+ Event event = new Event(word, datetime);
+ if (isDone) {
+ event.markItem();
+ }
+ this.wordList.add(event);
+ return event;
+ }
+
+ /**
+ * Mark the task with the index/itemNumber in the wordlist as done.
+ * @param itemNumber index of the task in the wordlist.
+ * @return string response statement
+ */
+ public String markItem(int itemNumber) {
+ this.wordList.get(itemNumber - 1).markItem();
+ String s = "Nice! I've marked this task as done: \n";
+ s += " " + this.wordList.get(itemNumber - 1);
+ return s;
+ }
+
+ /**
+ * Mark the task with the index/itemNumber in the wordlist as not done.
+ * @param itemNumber index of the task in the wordlist.
+ * @return string response statement
+ */
+ public String unmarkItem(int itemNumber) {
+ this.wordList.get(itemNumber - 1).unmarkItem();
+ String s = "Nice! I've marked this task as not done: \n";
+ s += " " + this.wordList.get(itemNumber - 1);
+ return s;
+ }
+
+ /**
+ * Remove the task with the index/itemNumber in the wordlist. Also returns the task removed.
+ * @param itemNumber index of the task in the wordlist.
+ * @return the task removed
+ */
+ public WordListItem removeItem(int itemNumber) {
+ WordListItem wordListItem = this.wordList.remove(itemNumber - 1);
+ return wordListItem;
+ }
+
+ /**
+ * Find items with the keyword as the substring.
+ * @param keyword the keyword used to detect the tasks.
+ * @return an array of tasks.
+ */
+ public WordListItem[] findItems(String keyword) {
+ return wordList.stream().filter(wordListItem -> wordListItem.getDescription().contains(keyword))
+ .toArray(WordListItem[]::new);
+ }
+
+ /**
+ * Get the size of the current wordlist.
+ * @return the length.
+ */
+ public int length() {
+ return this.wordList.size();
+ }
+
+ /**
+ * Iterate through the tasks inside of the wordlist.
+ * @param action a consumer which consumes the tasks.
+ */
+ public void forEach(Consumer super WordListItem> action) {
+ wordList.forEach(action);
+ }
+
+ public WordListItem[] sortedItemsByDescription() {
+ return wordList.stream().sorted((x, y) -> x.getDescription().compareTo(y.getDescription()))
+ .toArray(WordListItem[]::new);
+ }
+
+ public WordListItem[] sortedDeadlines() {
+ return wordList.stream().filter(x -> x instanceof Deadline)
+ .map(x -> (Deadline) x)
+ .sorted((x, y) -> x.getDatetime().compareTo(y.getDatetime()))
+ .toArray(WordListItem[]::new);
+ }
+
+ public WordListItem[] sortedEvents() {
+ return wordList.stream().filter(x -> x instanceof Event)
+ .map(x -> (Event) x)
+ .sorted((x, y) -> x.getDatetime().compareTo(y.getDatetime()))
+ .toArray(WordListItem[]::new);
+ }
+
+ @Override
+ public String toString() {
+ int i = 1;
+ String str = "";
+ str += "Here is your current tasks:\n";
+ for(WordListItem wordListItem: this.wordList) {
+ str += i + ". " + wordListItem + "\n";
+ i++;
+ }
+ return str;
+ }
+}
diff --git a/src/main/java/duke/tasks/WordListItem.java b/src/main/java/duke/tasks/WordListItem.java
new file mode 100644
index 0000000000..71934f00d4
--- /dev/null
+++ b/src/main/java/duke/tasks/WordListItem.java
@@ -0,0 +1,67 @@
+package duke.tasks;
+
+/**
+ * A WordList item in which all the tasks (Todo, Deadline, Event) derives from.
+ * A WordListItem is stored inside a WordList object.
+ * As WordListItem is a more general tasks, it has a description and isDone label.
+ * @see duke.tasks.Todo
+ * @see duke.tasks.Deadline
+ * @see duke.tasks.Event
+ */
+public abstract class WordListItem {
+ private String description;
+ private boolean isDone;
+
+ /**
+ * A generic constructor for all WordListItem.
+ * @param description
+ */
+ public WordListItem(String description) {
+ this.description = description;
+ this.isDone = false;
+ }
+
+ /**
+ * mark this WordListItem as done
+ */
+ public void markItem() {
+ this.isDone = true;
+ }
+
+ /**
+ * mark this WordListItem as not done
+ */
+ public void unmarkItem() {
+ this.isDone = false;
+ }
+
+ /**
+ * get the description of the WordListItem
+ * @return
+ */
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * get the isDone of the WordListItem
+ * @return
+ */
+ public boolean getIsDone() {
+ return this.isDone;
+ }
+
+ /**
+ * get the symbol of WordListItem
+ * @return null
+ */
+ static public String getSymbol() {
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ String doneSymbol = isDone ? "[X]" : "[ ]";
+ return doneSymbol + " " + this.description;
+ }
+}
diff --git a/src/main/java/duke/ui/DukeUI.java b/src/main/java/duke/ui/DukeUI.java
new file mode 100644
index 0000000000..97cb08c41c
--- /dev/null
+++ b/src/main/java/duke/ui/DukeUI.java
@@ -0,0 +1,121 @@
+package duke.ui;
+
+import duke.tasks.Todo;
+import duke.tasks.WordList;
+import duke.tasks.WordListItem;
+
+import java.util.Scanner;
+
+/**
+ * the UI handling the frontside of the app.
+ * DukeUI handles the receiving of input and displaying of output.
+ */
+public class DukeUI {
+ private Scanner scanner;
+
+ /**
+ * Constructor for DukeUI. Accepts a scanner.
+ * @param scanner a scanner to receive inputs.
+ */
+ public DukeUI(Scanner scanner) {
+ this.scanner = scanner;
+ }
+
+ /**
+ * Wait and returns the input received by the UI.
+ * @return a string from the line of input.
+ */
+ public String waitForinput() {
+ return scanner.nextLine();
+ }
+
+ /**
+ * Display the object given to the UI.
+ * @param object any object to be displayed.
+ */
+ public void display(Object object) {
+ System.out.println(object);
+ }
+
+ /**
+ * Returns the string response of the tasks found with the matching keyword in the list of tasks.
+ * @param wordListItems array of list of tasks
+ * @param keyword the keyword
+ * @return
+ */
+ public String displayFoundItem(WordListItem[] wordListItems, String keyword) {
+ String s = "";
+ int i = 1;
+ s += " Here are the tasks matching '" + keyword + "':\n";
+ for (WordListItem wordListItem: wordListItems) {
+ s += " " + i + ". "+ wordListItem +"\n";
+ i++;
+ }
+ s += " You have " + wordListItems.length + " matching results.";
+ return s;
+ }
+
+ public String displaySortedList(WordListItem[] wordListItems) {
+ String s = "";
+ s += " Here are the sorted tasks:\n";
+ int i = 1;
+ for (WordListItem wordListItem: wordListItems) {
+ s += " " + i + ". "+ wordListItem +"\n";
+ i++;
+ }
+ s += " You have " + wordListItems.length + " sorted results.";
+ return s;
+ }
+
+ /**
+ * Returns the string response of a task when added to the wordlist.
+ * @param wordListItem - the task
+ * @param wordList - the wordList
+ * @return
+ */
+ public String echoAddedItem(WordListItem wordListItem, WordList wordList) {
+ String s = "";
+ s += " Got it. I've added this task: \n";
+ s += " " + wordListItem + "\n";
+ s += " You currently have " + wordList.length() + " tasks in your list \n";
+ return s;
+ }
+
+ /**
+ * Returns the string response of a task when removed from the wordlist.
+ * @param wordListItem - the task
+ * @param wordList - the wordList
+ * @return
+ */
+ public String echoRemovedItem(WordListItem wordListItem, WordList wordList) {
+ String s = "";
+ s += " Got it. I've removed this task: \n";
+ s += " " + wordListItem + "\n";
+ s += " You currently have " + wordList.length() + " tasks in your list \n";
+ return s;
+ }
+
+ /**
+ * Echo a welcome message when the app is initiated.
+ */
+ public void replyWelcomeMessage() {
+ System.out.println("Hello! I'm Duke");
+ System.out.println("What can I do for you?");
+ }
+
+ /**
+ * Echo an error message when an exception occurs.
+ * @param e the error message
+ */
+ public void replyError(Exception e) {
+ System.out.println("Oh no! Duke is encountering a problem :(");
+ System.out.println(e.getMessage());
+ }
+
+ /**
+ * Echo a goodbye message when the app is closed.
+ */
+ public void replyBye() {
+ System.out.println("Bye. Hope to see you again soon!");
+ }
+}
diff --git a/src/main/resources/images/DaDuke.jpeg b/src/main/resources/images/DaDuke.jpeg
new file mode 100644
index 0000000000..5a9f17860b
Binary files /dev/null and b/src/main/resources/images/DaDuke.jpeg differ
diff --git a/src/main/resources/images/DaUser.jpeg b/src/main/resources/images/DaUser.jpeg
new file mode 100644
index 0000000000..cb645381c9
Binary files /dev/null and b/src/main/resources/images/DaUser.jpeg differ
diff --git a/src/main/resources/view/DialogBox.fxml b/src/main/resources/view/DialogBox.fxml
new file mode 100644
index 0000000000..b84e353327
--- /dev/null
+++ b/src/main/resources/view/DialogBox.fxml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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..567edfad49
--- /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/DateTimeManagerTest.java b/src/test/java/DateTimeManagerTest.java
new file mode 100644
index 0000000000..a8dbed4843
--- /dev/null
+++ b/src/test/java/DateTimeManagerTest.java
@@ -0,0 +1,17 @@
+import duke.managers.DateTimeManager;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.time.LocalDateTime;
+
+public class DateTimeManagerTest {
+ @Test
+ public void parseDateTimeStringTest() {
+ String strInput = "14/02/2022 1212";
+ String strOutput = "Monday, 14 Feb 2022 12:12";
+ LocalDateTime localDateTime = DateTimeManager.parseString(strInput);
+ assertEquals(strInput, DateTimeManager.getOriginalString(localDateTime));
+ assertEquals(strOutput, DateTimeManager.getDisplayString(localDateTime));
+ }
+}
diff --git a/src/test/java/DukeTest.java b/src/test/java/DukeTest.java
new file mode 100644
index 0000000000..ba1419016c
--- /dev/null
+++ b/src/test/java/DukeTest.java
@@ -0,0 +1,24 @@
+import org.junit.jupiter.api.Test;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import duke.Duke;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class DukeTest {
+ @Test
+ public void dummyTest(){
+ assertEquals(2, 2);
+ }
+
+ @Test
+ public void setUpSaveSystemTest(){
+ String str = System.getProperty("user.dir");
+ Path p = Paths.get(str, "test", "test.json");
+ new Duke("test/", "test.json");
+ assertEquals(true, Files.exists(p));
+ }
+}
diff --git a/src/test/java/WordListTest.java b/src/test/java/WordListTest.java
new file mode 100644
index 0000000000..e0217f8483
--- /dev/null
+++ b/src/test/java/WordListTest.java
@@ -0,0 +1,39 @@
+import duke.tasks.Deadline;
+import duke.tasks.Event;
+import duke.tasks.Todo;
+import duke.tasks.WordList;
+import org.junit.jupiter.api.Test;
+
+import java.time.LocalDateTime;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class WordListTest {
+ @Test
+ public void storeTodoTest() {
+ WordList wordList = new WordList();
+ Todo todo = wordList.storeTodo("hahaha", true);
+ assertEquals(true, todo.getIsDone());
+ assertEquals("hahaha", todo.getDescription());
+ }
+
+ @Test
+ public void storeDeadlineTest() {
+ LocalDateTime localDateTime = LocalDateTime.of(2020,12,12,12,12);
+ WordList wordList = new WordList();
+ Deadline deadline = wordList.storeDeadline("hahahaha", localDateTime, true);
+ assertEquals(true, deadline.getIsDone());
+ assertEquals("hahahaha", deadline.getDescription());
+ assertEquals(localDateTime, deadline.getDatetime());
+ }
+
+ @Test
+ public void storeEventTest() {
+ LocalDateTime localDateTime = LocalDateTime.of(2020,12,12,12,12);
+ WordList wordList = new WordList();
+ Event event = wordList.storeEvent("hahahahaha", localDateTime, true);
+ assertEquals(true, event.getIsDone());
+ assertEquals("hahahahaha", event.getDescription());
+ assertEquals(localDateTime, event.getDatetime());
+ }
+}
diff --git a/src/test/test/test.json b/src/test/test/test.json
new file mode 100644
index 0000000000..0637a088a0
--- /dev/null
+++ b/src/test/test/test.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/test/test.json b/test/test.json
new file mode 100644
index 0000000000..0637a088a0
--- /dev/null
+++ b/test/test.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index e69de29bb2..aecff3434f 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -0,0 +1,3 @@
+todo test todo
+event test event /at 10/10/2002 1800
+deadline test deadline /by 10/01/2002 1900
\ 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