diff --git a/README.md b/README.md
index 8715d4d915..1011b801b1 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# 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 maybe 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
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000000..46b9671e45
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,60 @@
+plugins {
+ id 'java'
+ id 'application'
+ id 'checkstyle'
+ id 'com.github.johnrengelman.shadow' version '5.1.0'
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ String javaFxVersion = '11'
+
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
+ testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
+ testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
+}
+
+test {
+ useJUnitPlatform()
+
+ testLogging {
+ events "passed", "skipped", "failed"
+
+ showExceptions true
+ exceptionFormat "full"
+ showCauses true
+ showStackTraces true
+ showStandardStreams = false
+ }
+}
+
+application {
+ mainClassName = "duke.Launcher"
+}
+
+shadowJar {
+ archiveBaseName = "duke"
+ archiveClassifier = null
+}
+
+checkstyle {
+ toolVersion = '8.29'
+}
+
+run{
+ standardInput = System.in
+}
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000000..4e2eb84de9
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,403 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml
new file mode 100644
index 0000000000..135ea49ee0
--- /dev/null
+++ b/config/checkstyle/suppressions.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/data/tasks.txt b/data/tasks.txt
new file mode 100644
index 0000000000..83cfe47a3f
--- /dev/null
+++ b/data/tasks.txt
@@ -0,0 +1,3 @@
+D|0|submit iP|1111-11-11-11-11
+T|0|eat snake
+D|0|grow shrooms|2021-8-21-8-0
diff --git a/docs/README.md b/docs/README.md
index 8077118ebe..0c121d2388 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,29 +1,198 @@
# User Guide
+
+
+Duke but with Animal Crossing animals :D
## Features
-### Feature-ABC
+### Keeping track of tasks
+
+You can add, delete, mark tasks as done/undone.
+
+### Text-based interface
-Description of the feature.
+Command and control Duke using just your keyboard!
-### Feature-XYZ
+### Different types of tasks
+Different type of task for different occasion
+1. To-Do
+2. Event
+3. Deadline
-Description of the feature.
## Usage
-### `Keyword` - Describe action
+### `todo` - Create a To-Do task
-Describe the action and its outcome.
+Creates a new to-do task and add it into your tasklist
+
+Format: `todo TASK_NAME`
Example of usage:
-`keyword (optional arguments)`
+`todo Wash shoe`
+
+Expected outcome:
+
+Confirmation from Duke that the task has been added
+
+```
+Got it! I've added
+ [T][]Wash shoe
+```
+
+### `deadline` - Create a Deadline task
+
+Creates a new task with a deadline and add it into your tasklist
+
+Format: `deadline TASK_NAME /by yyyy-mm-dd HHMM`
+
+Example of usage:
+
+`deadline Sleep /by 2021-12-30 2300`
+
+Expected outcome:
+
+Confirmation from Duke that the task has been added
+
+```
+Got it! I've added
+ [D][]Sleep (by: DEC 30 2021 23:00)
+```
+
+### `event` - Create an Event task
+
+Creates a new event with a timing and add it into your tasklist
+
+Format: `event TASK_NAME /at yyyy-mm-dd HHMM`
+
+Example of usage:
+
+`event Go dance party /at 2021-12-31 2300`
Expected outcome:
-Description of the outcome.
+Confirmation from Duke that the task has been added
```
-expected output
+Got it! I've added
+ [E][]Go dance party (at: DEC 31 2021 23:00)
+```
+
+### `mark` - Marks a task as completed
+
+Marks a task as completed
+
+Format: `mark INDEX`
+
+Example of usage:
+
+`mark 1`
+
+Expected outcome:
+
+Confirmation from Duke that the task has been marked
+
+```
+Congrats on completing:
+ [E][X]Go dance party (at: DEC 31 2021 23:00)
+```
+
+### `unmark` - Marks a task as uncompleted
+
+Marks a task as uncompleted
+
+Format: `unmark INDEX`
+
+Example of usage:
+
+`unmark 1`
+
+Expected outcome:
+
+Confirmation from Duke that the task has been unmarked
+
+```
+Congrats on not completing:
+ [E][]Go dance party (at: DEC 31 2021 23:00)
+```
+
+### `list` - See all task
+
+List down all existing tasks
+
+Format: `list`
+
+Example of usage:
+
+`list`
+
+Expected outcome:
+
+A list of all existing tasks
+
+```
+Here are the task:
+ 1.[D][X]Sleep (by: DEC 30 2021 23:00)
+ 2.[E][]Go dance party (at: DEC 31 2021 23:00)
+```
+
:bulb: **Tip**
+The number on the left of the task is their respective index, which will be used for `mark`, `unmark` and `delete`
+
+
+### `find` - Find all tasks with a given keyword
+
+Find all tasks based on a given keyword given by the user
+
+Format: `find KEYWORD`
+
+Example of usage:
+
+`find apple`
+
+Expected outcome:
+
+A list of all existing tasks with the keyword "apple"
+
+```
+Here are the task:
+ 1.[T][X]Bake apple cake
+ 2.[T][]Eat apple
+```
+
+### `delete` - Delete a task
+
+Delete a task based on its index in the tasklist
+
+Format: `delete INDEX`
+
+Example of usage:
+
+`delete 1`
+
+Expected outcome:
+
+Confirmation from Duke that the task has been deleted
+
+```
+Removed this task:
+ 1.[T][X]Bake apple cake
+```
+
+### `bye` - End Duke
+
+Closes the Duke application
+
+Format: `bye`
+
+Example of usage:
+
+`bye`
+
+Expected outcome:
+
+Application closes
+
```
+Sayonara!~
+```
\ No newline at end of file
diff --git a/docs/Ui.png b/docs/Ui.png
new file mode 100644
index 0000000000..fa9197f21e
Binary files /dev/null and b/docs/Ui.png differ
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000..f3d88b1c2f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000..b7c8c5dbf5
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000000..2fe81a7d95
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,183 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000000..62bd9b9cce
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,103 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java
deleted file mode 100644
index 5d313334cc..0000000000
--- a/src/main/java/Duke.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class Duke {
- public static void main(String[] args) {
- String logo = " ____ _ \n"
- + "| _ \\ _ _| | _____ \n"
- + "| | | | | | | |/ / _ \\\n"
- + "| |_| | |_| | < __/\n"
- + "|____/ \\__,_|_|\\_\\___|\n";
- System.out.println("Hello from\n" + logo);
- }
-}
diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..120c87e906
--- /dev/null
+++ b/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: duke.Launcher
+
diff --git a/src/main/java/duke/DateTime.java b/src/main/java/duke/DateTime.java
new file mode 100644
index 0000000000..037648690b
--- /dev/null
+++ b/src/main/java/duke/DateTime.java
@@ -0,0 +1,52 @@
+package duke;
+
+import java.time.*;
+
+/**
+ * DateTime object handles the storage and reading of date and time in Java format (YYYY-MM-DD HH:MM)
+ */
+public class DateTime {
+ private final LocalDateTime dateTime;
+
+ DateTime(String[] dateTimeArr) {
+ this.dateTime = LocalDateTime.of(Integer.parseInt(dateTimeArr[0])
+ , Integer.parseInt(dateTimeArr[1])
+ , Integer.parseInt(dateTimeArr[2])
+ , Integer.parseInt(dateTimeArr[3])
+ , Integer.parseInt(dateTimeArr[4]));
+ }
+
+ @Override
+ public String toString() {
+ String minutes = "";
+ if (this.dateTime.getMinute() < 10) {
+ minutes = "0" + this.dateTime.getMinute();
+ } else {
+ minutes = String.valueOf(this.dateTime.getMinute());
+ }
+ return this.dateTime.getMonth().toString().substring(0, 3) + " "
+ + this.dateTime.getDayOfMonth() + " "
+ + this.dateTime.getYear() + " "
+ + this.dateTime.getHour() + ":"
+ + minutes;
+ }
+
+ /**
+ * Changes the date time in YYYY-MM-DD HH:MM into String for writing into Storage
+ *
+ * @return String format of dateTime (YYYY-MM-DD-HH-MM)
+ */
+ public String dateTimeForStorage() {
+ String toBeStored = "";
+ toBeStored = this.dateTime.getYear()
+ + "-"
+ + this.dateTime.getMonthValue()
+ + "-"
+ + this.dateTime.getDayOfMonth()
+ + "-"
+ + this.dateTime.getHour()
+ + "-"
+ + this.dateTime.getMinute();
+ return toBeStored;
+ }
+}
diff --git a/src/main/java/duke/Deadlines.java b/src/main/java/duke/Deadlines.java
new file mode 100644
index 0000000000..d402ad6539
--- /dev/null
+++ b/src/main/java/duke/Deadlines.java
@@ -0,0 +1,30 @@
+package duke;
+
+/**
+ * Deadlines tasks that need to be done before a specific date/time
+ * e.g., submit report by 11/10/2019 5pm
+ */
+
+public class Deadlines extends Task {
+
+ private final DateTime deadline;
+
+ public Deadlines(String description, DateTime deadline) {
+ super(description);
+ this.deadline = deadline;
+ }
+
+ /**
+ * Gets date and time of this Deadlines object
+ *
+ * @return date and time in String format
+ */
+ public String getDateTimeForStorage() {
+ return this.deadline.dateTimeForStorage();
+ }
+
+ @Override
+ public String toString() {
+ return "[D]" + super.toString() + " (by: " + this.deadline.toString() + ")";
+ }
+}
diff --git a/src/main/java/duke/DialogBox.java b/src/main/java/duke/DialogBox.java
new file mode 100644
index 0000000000..70d7fd65bc
--- /dev/null
+++ b/src/main/java/duke/DialogBox.java
@@ -0,0 +1,62 @@
+package duke;
+
+import java.io.IOException;
+import java.util.Collections;
+
+import duke.MainWindow;
+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;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/duke/Duke.java b/src/main/java/duke/Duke.java
new file mode 100644
index 0000000000..816624344b
--- /dev/null
+++ b/src/main/java/duke/Duke.java
@@ -0,0 +1,212 @@
+package duke;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import javafx.application.Application;
+import javafx.application.Platform;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.layout.Region;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+
+
+/**
+ * Project Duke is a educational software project designed to take you
+ * through the steps of building a small software incrementally,
+ * while applying as many Java and SE techniques as possible along the way.
+ *
+ * @author AdrianOngJJ
+ * @version 0.1
+ * @since 22/1/2022
+ */
+public class Duke extends Application {
+ private static final String LINE_BREAK = "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
+ private static ArrayList masterList = new ArrayList<>();
+ private Storage storage;
+ private TaskList tasks;
+ private Parser parser;
+ private Ui ui;
+ public static final String END_MESSAGE = "Sayonara~";
+ private ScrollPane scrollPane;
+ private VBox dialogContainer;
+ private TextField userInput;
+ private Button sendButton;
+ private Scene scene;
+ private Image user = new Image(this.getClass().getResourceAsStream("/images/isabell.png"));
+ private Image duke = new Image(this.getClass().getResourceAsStream("/images/kkslider.png"));
+
+
+
+ public Duke(String filePath) {
+ this.ui = new Ui(LINE_BREAK);
+ storage = new Storage(filePath);
+ this.parser = new Parser();
+ try {
+ tasks = new TaskList(storage.load());
+ } catch (DukeException e) {
+ System.out.println(e.getMessage());
+ tasks = new TaskList();
+ } catch (IOException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ /**
+ * Runs Duke to receive commands until command "bye" is given
+ */
+ public void run() {
+// this.ui.initUi();
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
+ Parser parser = new Parser();
+ String parserOutput = "";
+ while (!parserOutput.equals(END_MESSAGE)) {
+ try {
+ String input = br.readLine();
+ parserOutput = parser.parse(input, this.tasks, this.storage);
+ System.out.println(parserOutput);
+ } catch (DukeException e) {
+ System.out.println(e.getMessage());
+ } catch (IOException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ new Duke("/tasks.txt").run();
+ }
+
+ public Duke() {}
+
+ @Override
+ public void start(Stage stage) {
+ //Step 1. Setting up required components
+
+ //The container for the content of the chat to scroll.
+ scrollPane = new ScrollPane();
+ dialogContainer = new VBox();
+ scrollPane.setContent(dialogContainer);
+
+ userInput = new TextField();
+ sendButton = new Button("Send");
+
+ AnchorPane mainLayout = new AnchorPane();
+ mainLayout.getChildren().addAll(scrollPane, userInput, sendButton);
+
+ scene = new Scene(mainLayout);
+
+ stage.setScene(scene);
+ stage.show();
+
+ //Step 2. Formatting the window to look as expected
+ stage.setTitle("Duke");
+ stage.setResizable(false);
+ stage.setMinHeight(600.0);
+ stage.setMinWidth(400.0);
+
+ mainLayout.setPrefSize(400.0, 600.0);
+
+ scrollPane.setPrefSize(385, 535);
+ scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
+ scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
+
+ scrollPane.setVvalue(1.0);
+ scrollPane.setFitToWidth(true);
+
+ // You will need to import `javafx.scene.layout.Region` for this.
+ dialogContainer.setPrefHeight(Region.USE_COMPUTED_SIZE);
+
+ userInput.setPrefWidth(325.0);
+
+ sendButton.setPrefWidth(55.0);
+
+ AnchorPane.setTopAnchor(scrollPane, 1.0);
+
+ AnchorPane.setBottomAnchor(sendButton, 1.0);
+ AnchorPane.setRightAnchor(sendButton, 1.0);
+
+ AnchorPane.setLeftAnchor(userInput , 1.0);
+ AnchorPane.setBottomAnchor(userInput, 1.0);
+
+ //Step 3. Add functionality to handle user input.
+ sendButton.setOnMouseClicked((event) -> {
+ dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
+ userInput.clear();
+ });
+
+ userInput.setOnAction((event) -> {
+ dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
+ userInput.clear();
+ });
+
+ //Scroll down to the end every time dialogContainer's height changes.
+ dialogContainer.heightProperty().addListener((observable) -> scrollPane.setVvalue(1.0));
+
+ //Part 3. Add functionality to handle user input.
+ sendButton.setOnMouseClicked((event) -> {
+ handleUserInput();
+ });
+
+ userInput.setOnAction((event) -> {
+ handleUserInput();
+ });
+ }
+
+ /**
+ * Iteration 1:
+ * Creates a label with the specified text and adds it to the dialog container.
+ * @param text String containing text to add
+ * @return a label with the specified text that has word wrap enabled.
+ */
+ private Label getDialogLabel(String text) {
+ // You will need to import `javafx.scene.control.Label`.
+ Label textToAdd = new Label(text);
+ textToAdd.setWrapText(true);
+
+ return textToAdd;
+ }
+
+ /**
+ * Iteration 2:
+ * 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.
+ */
+ private void handleUserInput() {
+ Label userText = new Label(userInput.getText());
+ Label dukeText = new Label(getResponse(userInput.getText()));
+ dialogContainer.getChildren().addAll(
+ DialogBox.getUserDialog(userText.toString(), new ImageView(user).getImage()),
+ DialogBox.getDukeDialog(dukeText.toString(), new ImageView(duke).getImage())
+ );
+ userInput.clear();
+ }
+
+ /**
+ * You should have your own function to generate a response to user input.
+ * Replace this stub with your completed method.
+ */
+ public String getResponse(String input) {
+ String toReturn = "";
+ try {
+ toReturn = parser.parse(input, this.tasks, this.storage);
+ } catch (DukeException e) {
+ return e.getMessage();
+ } catch (IOException e) {
+ return e.getMessage();
+ }
+
+ return toReturn;
+ }
+}
diff --git a/src/main/java/duke/DukeException.java b/src/main/java/duke/DukeException.java
new file mode 100644
index 0000000000..eca34308bf
--- /dev/null
+++ b/src/main/java/duke/DukeException.java
@@ -0,0 +1,19 @@
+package duke;
+
+/**
+ * Exception class for Duke to handle Exceptions
+ */
+
+public class DukeException extends Exception {
+
+ private String message;
+ public DukeException(String message) {
+ this.message = message;
+ }
+
+ @Override
+ public String getMessage() {
+ return this.message;
+ }
+
+}
diff --git a/src/main/java/duke/Events.java b/src/main/java/duke/Events.java
new file mode 100644
index 0000000000..7ad46f7e53
--- /dev/null
+++ b/src/main/java/duke/Events.java
@@ -0,0 +1,30 @@
+package duke;
+
+/**
+ * Events are tasks that start at a specific time and ends at a specific time
+ * e.g., team project meeting on 2/10/2019 2-4pm
+ */
+
+public class Events extends Task {
+
+ private final DateTime duration;
+
+ public Events(String description, DateTime duration) {
+ super(description);
+ this.duration = duration;
+ }
+
+ /**
+ * Gets date and time of this Events object
+ *
+ * @return Date and time in String format
+ */
+ public String getDateTimeForStorage() {
+ return this.duration.dateTimeForStorage();
+ }
+
+ @Override
+ public String toString() {
+ return "[E]" + super.toString() + " (at: " + this.duration.toString() + ")";
+ }
+}
diff --git a/src/main/java/duke/Launcher.java b/src/main/java/duke/Launcher.java
new file mode 100644
index 0000000000..5483e63637
--- /dev/null
+++ b/src/main/java/duke/Launcher.java
@@ -0,0 +1,12 @@
+package duke;
+
+import javafx.application.Application;
+
+/**
+ * A launcher class to workaround classpath issues.
+ */
+public class Launcher {
+ public static void main(String[] args) {
+ Application.launch(Main.class, args);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/duke/Main.java b/src/main/java/duke/Main.java
new file mode 100644
index 0000000000..779319b930
--- /dev/null
+++ b/src/main/java/duke/Main.java
@@ -0,0 +1,31 @@
+package duke;
+
+import java.io.IOException;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Scene;
+import javafx.scene.layout.AnchorPane;
+import javafx.stage.Stage;
+
+/**
+ * A GUI for Duke using FXML.
+ */
+public class Main extends Application {
+
+ private Duke duke = new Duke("/tasks.txt");
+
+ @Override
+ public void start(Stage stage) {
+ try {
+ FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/MainWindow.fxml"));
+ AnchorPane ap = fxmlLoader.load();
+ Scene scene = new Scene(ap);
+ stage.setScene(scene);
+ fxmlLoader.getController().setDuke(duke);
+ stage.show();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/duke/MainWindow.java b/src/main/java/duke/MainWindow.java
new file mode 100644
index 0000000000..d3951cd3b7
--- /dev/null
+++ b/src/main/java/duke/MainWindow.java
@@ -0,0 +1,56 @@
+package duke;
+
+import javafx.application.Platform;
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.control.TextField;
+import javafx.scene.image.Image;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.VBox;
+/**
+ * Controller for MainWindow. Provides the layout for the other controls.
+ */
+public class MainWindow extends AnchorPane {
+ @FXML
+ private ScrollPane scrollPane;
+ @FXML
+ private VBox dialogContainer;
+ @FXML
+ private TextField userInput;
+ @FXML
+ private Button sendButton;
+
+ private Duke duke;
+
+ private Image userImage = new Image(this.getClass().getResourceAsStream("/images/isabell.png"));
+ private Image dukeImage = new Image(this.getClass().getResourceAsStream("/images/kkslider.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();
+ if (response.equals(Duke.END_MESSAGE)) {
+ Platform.exit();
+ }
+
+ }
+}
diff --git a/src/main/java/duke/Parser.java b/src/main/java/duke/Parser.java
new file mode 100644
index 0000000000..5cca3441b7
--- /dev/null
+++ b/src/main/java/duke/Parser.java
@@ -0,0 +1,121 @@
+package duke;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * Handles the raw input from user to create the corresponding objects
+ */
+public class Parser {
+
+ private final String ADD_SUCCESS = "Got it! I've added:\n\t";
+ private final String MARK_SUCCESS = "Congrats on completing:\n\t";
+ private final String UNMARK_SUCCESS = "Congrats on not completing:\n\t";
+ private final String DELETE_SUCCESS = "Removed this task:\n\t";
+
+
+ /**
+ * Gets the description from the raw input given by user
+ *
+ * @param inputArr raw input with command word, description and date time
+ * @return String of description of input only
+ */
+ private final String getDescription(String[] inputArr) {
+ return inputArr[1].split("/")[0]; // split input from slash
+ }
+
+ /**
+ * Gets date and time from the raw input given by the user
+ *
+ * @param inputArr raw input with command word, description and date time
+ * @return DateTime of input only
+ */
+ private final DateTime getDateTime(String[] inputArr) {
+ String[] dateTimeArr = new String[6];
+ dateTimeArr = inputArr[1].split("/")[1].split("[- ]"); // [String, yyyy, mm, dd, HHMM, null]
+ dateTimeArr[0] = dateTimeArr[4].substring(0, 2); // hours
+ String year = dateTimeArr[1];
+ String month = dateTimeArr[2];
+ String day = dateTimeArr[3];
+ String hour = dateTimeArr[4].substring(0, 2);
+ String minute = dateTimeArr[4].substring(2, 4);
+ String[] toFeedDateTime = { year, month, day, hour, minute};
+ return new DateTime(toFeedDateTime);
+ // will reduce dateTimeArr to [yyyy, mm, dd, HHMM]
+ }
+
+ /**
+ * Adds given task into tasklist
+ *
+ * @param task Task to be added
+ * @param tasklist Tasklist to be store the new task
+ */
+ private void addToTaskList(Task task, TaskList tasklist) {
+ tasklist.addTask(task);
+ }
+
+ /**
+ * Makes sense of the input given by the user
+ *
+ * @param input Raw input given by user
+ * @param tasklist Tasklist where tasks are to be updated
+ * @param storage Holds the backend storage of the file
+ * @return String of the result of the task executed
+ * @throws DukeException Incorrect use/format of Duke commands
+ * @throws IOException Missing file/null error
+ */
+ public String parse(String input, TaskList tasklist, Storage storage) throws DukeException, IOException {
+ String[] inputArr = input.trim().split(" ", 2); // split first word from body
+ switch(inputArr[0]) {
+ case "todo":
+ if (inputArr.length == 1) {
+ throw new DukeException("todo simi?");
+ }
+ ToDos newToDo = new ToDos(getDescription(inputArr));
+ addToTaskList(newToDo, tasklist);
+ return ADD_SUCCESS + newToDo;
+
+ case "event":
+ if (inputArr.length == 1) {
+ throw new DukeException("event description?");
+ }
+ Events newEvent = new Events(getDescription(inputArr), getDateTime(inputArr));
+ addToTaskList(newEvent, tasklist);
+ return ADD_SUCCESS + newEvent;
+
+ case "deadline":
+ if (inputArr.length == 1) {
+ throw new DukeException("deadline when end?");
+ }
+ Deadlines newDeadline = new Deadlines(getDescription(inputArr), getDateTime(inputArr));
+ addToTaskList(newDeadline, tasklist);
+ return ADD_SUCCESS + newDeadline;
+
+ case "list":
+ return tasklist.list();
+
+ case "bye":
+ storage.saveAllTasks(tasklist);
+ return "Sayonara~";
+
+ case "mark":
+ Task markedTask = tasklist.mark(Integer.parseInt(inputArr[1]) - 1);
+ return MARK_SUCCESS + markedTask;
+
+ case "unmark":
+ Task unmarkedTask = tasklist.unmark(Integer.parseInt(inputArr[1]) - 1);
+ return UNMARK_SUCCESS + unmarkedTask;
+
+ case "delete":
+ Task deletedTask = tasklist.delete(Integer.parseInt(inputArr[1]) - 1);
+ return DELETE_SUCCESS + deletedTask;
+
+ case "find":
+ return tasklist.find(inputArr[1]);
+ default:
+ throw new DukeException(":( OOPS!!!! I'm sorry, but I don't know what that means!");
+ }
+
+
+ }
+}
diff --git a/src/main/java/duke/Storage.java b/src/main/java/duke/Storage.java
new file mode 100644
index 0000000000..acafb9d19b
--- /dev/null
+++ b/src/main/java/duke/Storage.java
@@ -0,0 +1,145 @@
+package duke;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.nio.file.Paths;
+import java.nio.file.Files;
+import java.util.Scanner;
+
+/**
+ * Holds the filepath to the file in which the data will be stored
+ */
+public class Storage {
+ private String filePath;
+ private Path path;
+
+ Storage(String filePath) {
+ this.filePath = filePath;
+ String home = System.getProperty("user.home"); // base directory
+ // following code should give me [HOME_DIRECTORY]/Desktop/iP/data
+ this.path = java.nio.file.Paths.get(home);
+ }
+
+ /**
+ * Converts String stored in the database to create tasks when booting up Duke
+ *
+ * @param description Line read from the data file
+ * @return A task which will be added to the Tasklist
+ */
+ private Task convertStringToTask(String description) {
+ String[] splitDescription = description.split("\\|");
+ String taskType = splitDescription[0];
+ Task tempTask = new Task("Temp task");
+ switch (taskType) {
+ case "T":
+ Task newToDo = new ToDos(splitDescription[2]);
+ if (splitDescription[1].equals("1")) {
+ newToDo.markAsDone();
+ }
+ tempTask = newToDo;
+ break;
+
+ case "D":
+ Task newDeadline = new Deadlines(splitDescription[2], new DateTime(splitDescription[3].split("[- ]")));
+ if (splitDescription[1].equals("1")) {
+ newDeadline.markAsDone();
+ }
+ tempTask = newDeadline;
+ break;
+
+ case "E":
+ Task newEvent = new Events(splitDescription[2], new DateTime(splitDescription[3].split("[- ]")));
+ if (splitDescription[1].equals("1")) {
+ newEvent.markAsDone();
+ }
+ tempTask = newEvent;
+ break;
+
+ default:
+ System.out.println("All tasks loaded!");
+
+ }
+ return tempTask;
+ }
+
+ /**
+ * Read the data file and store it into an ArrayList
+ *
+ * @return An ArrayList of Tasks
+ * @throws IOException Missing file
+ * @throws DukeException Missing file
+ */
+ public ArrayList load() throws IOException, DukeException {
+ ArrayList masterList = new ArrayList<>();
+ try {
+ File dukeStore = new File(this.path + this.filePath);
+ Scanner fileReader = new Scanner(dukeStore);
+ while (fileReader.hasNextLine()) {
+ masterList.add(convertStringToTask(fileReader.nextLine()));
+ }
+ } catch (IOException e) {
+ Path filePath = Paths.get("data");
+ boolean isDirectoryExists = Files.exists(filePath);
+ if (!isDirectoryExists) {
+ new File("data").mkdir();
+ }
+ new File(path + "/tasks.txt").createNewFile();
+ throw new DukeException("File not found. Creating new file...");
+ }
+
+ return masterList;
+ }
+
+ /**
+ * Save all tasks before exiting Duke
+ *
+ * @param tasklist List of tasks to be saved
+ * @throws IOException Missing file
+ */
+ public void saveAllTasks(TaskList tasklist) throws IOException {
+ File dukeStore = new File(this.path + this.filePath);
+ FileWriter fw = new FileWriter(dukeStore);
+ for (int i = 0; i < tasklist.size(); i++) {
+ fw.write(taskToString(tasklist.get(i)));
+ fw.write("\n");
+ }
+ fw.close();
+ }
+
+ /**
+ * Converts a task to String for storage purposes
+ *
+ * @param task Task to be converted to String to be stored
+ * @return String of Task
+ */
+ private final String taskToString(Task task) {
+ String toReturn = "";
+ if (task instanceof ToDos) {
+ toReturn += "T|";
+ } else if (task instanceof Deadlines) {
+ toReturn += "D|";
+ } else if (task instanceof Events) {
+ toReturn += "E|";
+ }
+ if (task.isDone) {
+ toReturn += "1|";
+ } else {
+ toReturn += "0|";
+ }
+ toReturn += task.description.trim();
+ if (task instanceof Deadlines) {
+ String duration = ((Deadlines) task).getDateTimeForStorage();
+ toReturn += "|" + duration;
+ } else if (task instanceof Events) {
+ String duration = ((Events) task).getDateTimeForStorage();
+ toReturn += "|" + duration;
+ }
+ return toReturn;
+ }
+
+
+
+}
diff --git a/src/main/java/duke/Task.java b/src/main/java/duke/Task.java
new file mode 100644
index 0000000000..b058037583
--- /dev/null
+++ b/src/main/java/duke/Task.java
@@ -0,0 +1,45 @@
+package duke;
+
+/**
+ * Task class contains the task's name and whether it is completed
+ */
+public class Task {
+ protected String description;
+ protected boolean isDone;
+
+ public Task(String description) {
+ this.description = description;
+ this.isDone = false;
+ }
+
+ /**
+ * Check if task is done
+ * @return String "X" to indicate if a task is done
+ */
+ public String getStatusIcon() {
+ return (isDone ? "X" : " "); // mark done with X
+ }
+
+ /**
+ * Mark item as done
+ * @return Item that is done
+ */
+ public Task markAsDone() {
+ this.isDone = true;
+ return this;
+ }
+
+ /**
+ * Mark item as undone
+ * @return Item that is undone
+ */
+ public Task unmarkItem() {
+ this.isDone = false;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + getStatusIcon() + "] " + this.description;
+ }
+}
diff --git a/src/main/java/duke/TaskList.java b/src/main/java/duke/TaskList.java
new file mode 100644
index 0000000000..fb242660d8
--- /dev/null
+++ b/src/main/java/duke/TaskList.java
@@ -0,0 +1,94 @@
+package duke;
+
+import java.util.ArrayList;
+
+/**
+ * Handles the current list of Tasks while Duke is running
+ */
+public class TaskList {
+ private final String LIST_INIT = "Here are the task:\n";
+ private ArrayList masterList;
+
+ public TaskList(ArrayList list) {
+ this.masterList = list;
+ }
+
+ public TaskList() {
+ this.masterList = new ArrayList<>();
+ }
+
+ public int size() {
+ return this.masterList.size();
+ }
+
+ public Task get(int index) {
+ return this.masterList.get(index);
+ }
+
+ public void addTask(Task task) {
+ masterList.add(task);
+ }
+
+ /**
+ * Shows the list of existing tasks
+ *
+ * @return String of list of tasks
+ */
+ public String list() {
+ String toPrint = LIST_INIT;
+ for (int i = 0; i < masterList.size(); i++) {
+ Task currTask = masterList.get(i);
+ toPrint += "\t" + (i + 1) + ". " + currTask + "\n";
+ }
+ return toPrint;
+ }
+
+ /**
+ * Mark a task as done
+ *
+ * @param index Index of task in masterList
+ * @return Task marked as done
+ */
+ public Task mark(int index) {
+ Task currTask = masterList.get(index);
+ currTask.markAsDone();
+ masterList.set(index, currTask);
+ return currTask;
+ }
+
+ /**
+ * Mark a task as undone
+ *
+ * @param index Index of task in masterList
+ * @return Task marked as undone
+ */
+ public Task unmark(int index) {
+ Task currTask = masterList.get(index);
+ currTask.unmarkItem();
+ masterList.set(index, currTask);
+ return currTask;
+ }
+
+ /**
+ * Delete a task
+ *
+ * @param index Index of task in masterList
+ * @return Deleted task
+ */
+ public Task delete(int index) {
+ Task currTask = masterList.get(index);
+ masterList.remove(index);
+ return currTask;
+ }
+
+ public String find(String keyword) {
+ String toReturn = "Here are the matching tasks in your lists:\n";
+ for (int i = 0; i < masterList.size(); i++) {
+ if (masterList.get(i).toString().contains(keyword)) {
+ toReturn += "\t" + (i + 1) + "." + masterList.get(i) + "\n";
+ }
+ }
+
+ return toReturn;
+ }
+}
diff --git a/src/main/java/duke/ToDos.java b/src/main/java/duke/ToDos.java
new file mode 100644
index 0000000000..19c91198e6
--- /dev/null
+++ b/src/main/java/duke/ToDos.java
@@ -0,0 +1,15 @@
+package duke;
+
+/**
+ * To Dos are tasks without any date/time attached to it
+ */
+public class ToDos extends Task {
+ public ToDos(String description) {
+ super(description);
+ }
+
+ @Override
+ public String toString() {
+ return "[T]" + super.toString();
+ }
+}
diff --git a/src/main/java/duke/Ui.java b/src/main/java/duke/Ui.java
new file mode 100644
index 0000000000..9a39fc3752
--- /dev/null
+++ b/src/main/java/duke/Ui.java
@@ -0,0 +1,30 @@
+package duke;
+
+/**
+ * Handles the visual interaction with the user
+ */
+public class Ui {
+ private final String LOGO = " ____ _ \n"
+ + "| _ \\ _ _| | _____ \n"
+ + "| | | | | | | |/ / _ \\\n"
+ + "| |_| | |_| | < __/\n"
+ + "|____/ \\__,_|_|\\_\\___|\n";
+ private final String lineBreak;
+
+ Ui(String lineBreak) {
+ this.lineBreak = lineBreak;
+
+ }
+
+ public void initUi() {
+ System.out.println("Hello from\n" + LOGO);
+ printLineBreak();
+ System.out.println("Hello! I'm Duke\nWhat can I do for you?");
+ }
+
+ private final void printLineBreak() {
+ System.out.println(this.lineBreak);
+ }
+
+
+}
diff --git a/src/main/resources/images/isabell.png b/src/main/resources/images/isabell.png
new file mode 100644
index 0000000000..f6dc18d189
Binary files /dev/null and b/src/main/resources/images/isabell.png differ
diff --git a/src/main/resources/images/kkslider.png b/src/main/resources/images/kkslider.png
new file mode 100644
index 0000000000..dd22c0f0e7
Binary files /dev/null and b/src/main/resources/images/kkslider.png differ
diff --git a/src/main/resources/view/DialogBox.fxml b/src/main/resources/view/DialogBox.fxml
new file mode 100644
index 0000000000..e433809947
--- /dev/null
+++ b/src/main/resources/view/DialogBox.fxml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml
new file mode 100644
index 0000000000..832f84382e
--- /dev/null
+++ b/src/main/resources/view/MainWindow.fxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 657e74f6e7..97d48a7262 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -5,3 +5,45 @@ Hello from
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Hello! I'm Duke
+What can I do for you?
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+event project meeting /at Mon 2-4pm
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Got it. I've added this task:
+ [E][ ] project meeting (at: Mon 2-4pm)
+Now you have 1 tasks in the list.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+deadline return book /by Sunday
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Got it. I've added this task:
+ deadline return book /by Sunday
+Now you have 2 tasks in the list.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+list
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Here are the tasks in your list:
+1.[E][ ] project meeting (at: Mon 2-4pm)
+2.[D][ ] return book (by: Sunday)
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+bye
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Bye. Hope to see you again soon!
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Process finished with exit code 0
\ No newline at end of file
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index e69de29bb2..d59240a9cb 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -0,0 +1,10 @@
+todo read book
+deadline return book /by June 6th
+event project meeting /at Aug 6th 2-4pm
+todo join sports club
+mark 1
+mark 4
+todo borrow book
+list
+deadline return book /by Sunday
+event project meeting /at Mon 2-4pm
diff --git a/text-ui-test/runtest.bat b/text-ui-test/runtest.bat
index 0873744649..371a74b07a 100644
--- a/text-ui-test/runtest.bat
+++ b/text-ui-test/runtest.bat
@@ -7,7 +7,9 @@ REM delete output from previous run
if exist ACTUAL.TXT del ACTUAL.TXT
REM compile the code into the bin folder
-javac -cp ..\src\main\java -Xlint:none -d ..\bin ..\src\main\java\*.java
+
+javac -cp C:\Users\adria\Desktop\iP\src\main\java -Xlint:none -d ..\bin C:\Users\adria\Desktop\iP\src\main\java\*.java
+
IF ERRORLEVEL 1 (
echo ********** BUILD FAILURE **********
exit /b 1
@@ -15,7 +17,7 @@ IF ERRORLEVEL 1 (
REM no error here, errorlevel == 0
REM run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT
-java -classpath ..\bin Duke < input.txt > ACTUAL.TXT
+java -classpath ../bin Duke < input.txt > ACTUAL.TXT
REM compare the output to the expected output
FC ACTUAL.TXT EXPECTED.TXT
diff --git a/text-ui-test/runtest.sh b/text-ui-test/runtest.sh
old mode 100644
new mode 100755
index c9ec870033..c4458cdf46
--- a/text-ui-test/runtest.sh
+++ b/text-ui-test/runtest.sh
@@ -13,7 +13,7 @@ then
fi
# compile the code into the bin folder, terminates if error occurred
-if ! javac -cp ../src/main/java -Xlint:none -d ../bin ../src/main/java/*.java
+if ! javac -cp C:\Users\adria\Desktop\iP\src\main\java -Xlint:none -d ../bin C:\Users\adria\Desktop\iP\src\main\java*.java
then
echo "********** BUILD FAILURE **********"
exit 1