diff --git a/.gitignore b/.gitignore
index f69985ef1f..7f511bed1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ bin/
/text-ui-test/ACTUAL.txt
text-ui-test/EXPECTED-UNIX.TXT
+bobby.txt
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000000..8509feaa98
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,62 @@
+plugins {
+ id 'java'
+ id 'application'
+ id 'checkstyle'
+ id 'com.github.johnrengelman.shadow' version '5.1.0'
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
+ testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
+
+ String javaFxVersion = '11'
+
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
+}
+
+test {
+ useJUnitPlatform()
+
+ testLogging {
+ events "passed", "skipped", "failed"
+
+ showExceptions true
+ exceptionFormat "full"
+ showCauses true
+ showStackTraces true
+ showStandardStreams = false
+ }
+}
+
+application {
+ mainClassName = "bobby.Launcher"
+}
+
+shadowJar {
+ archiveBaseName = "bobby"
+ archiveClassifier = null
+}
+
+checkstyle {
+ toolVersion = '8.29'
+}
+
+run{
+ enableAssertions = true
+ standardInput = System.in
+}
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000000..4ffea51d5e
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,403 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml
new file mode 100644
index 0000000000..39efb6e4ac
--- /dev/null
+++ b/config/checkstyle/suppressions.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
diff --git a/docs/README.md b/docs/README.md
index 8077118ebe..97d5e3b271 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,29 +1,133 @@
# User Guide
+Bobby is a desktop app for managing your tasks. Utilize commands to add, remove and mark various types of tasks and Bobby will remember these tasks for you.
+
## Features
+* Adding a To Do: todo
+* Adding a Deadline: deadline
+* Adding an Event: event
+* Listing all tasks: list
+* Marking a task as done: mark
+* Umarking a task as done: unmark
+* Locating task in list: find
+* Deleting task: delete
+* Undo a change to list: undo
+* Exiting the program: bye
+* Saving the data
+
+
+### Adding a To Do
+
+Command: `todo`
+Adds a To Do to the list.
+
+Format: todo DESCRIPTION
+
+Examples:
+
+* todo CS2103 user guide
+* todo CS2106 quiz
+
+
+### Adding a Deadline
+
+Command: `deadline`
+Adds a Deadline to the list.
+
+Format: deadline DESCRIPTION /by YYYY-MM-DD
+
+Examples:
+
+* deadline CS2106 quiz /by 2022-02-20
+* deadline CS2103 quiz /by 2022-02-21
+
+
+### Adding an Event
+
+Command: `event`
+Adds an Event to the list.
+
+Format: event DESCRIPTION /at DESCRIPTION_OF_EVENTTIME
+
+Examples:
+
+* event Family dinner /at friday 6pm
+* event Recess week /at 20 February to 27 February
+
+
+### Listing all tasks
+
+Command: `list`
+Shows a list of all tasks in the list.
+
+Format: `list`
+
+
+###: Marking a task
+
+Command: `mark`
+Marks a task as done with an X.
+
+Format: mark INDEX
+
+Example:
+
+* mark 4
+
+
+### Unmarking a task
+
+Command: `unmark`
+Unmarks a task by removing the X.
+
+Format: unmark INDEX
+
+Example:
+
+* unmark 4
+
+
+### Finding a task
+
+Command: `find`
+Finds a task in the list with a keyword that matches task description.
+
+Format: find KEYWORD
+
+Examples:
+
+* find CS2103
+* find quiz
+
+
+### Deleting a task
+
+Command: `delete`
+Deletes a task from the list.
+
+Format: delete INDEX
+
+Example:
-### Feature-ABC
+* delete 5
-Description of the feature.
-### Feature-XYZ
+### Undo a change to the list
-Description of the feature.
+Command: `undo`
+Reverses a change to the list by a previous command.
-## Usage
+Format: `undo`
-### `Keyword` - Describe action
-Describe the action and its outcome.
+### Exit the program
-Example of usage:
+Command: `bye`
+Exits the program.
-`keyword (optional arguments)`
+Format: `bye`
-Expected outcome:
-Description of the outcome.
+### Saving the data
-```
-expected output
-```
+Bobby's data of your list of tasks is saved in the hard disk automatically after any command that changes the data. There is no need to save manually.
diff --git a/docs/Ui.png b/docs/Ui.png
new file mode 100644
index 0000000000..055242779d
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..c741881743
--- /dev/null
+++ b/docs/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-slate
\ 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..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/bobby/Bobby.java b/src/main/java/bobby/Bobby.java
new file mode 100644
index 0000000000..7e6db78e8d
--- /dev/null
+++ b/src/main/java/bobby/Bobby.java
@@ -0,0 +1,26 @@
+package bobby;
+
+/**
+ * The Bobby program serves as a notepad, taking in various user
+ * inputs to execute commands such as adding different types of
+ * tasks, marking tasks as done and deleting tasks.
+ */
+public class Bobby {
+
+ private Storage storage;
+ private TaskList tasks;
+
+ /**
+ * Creates an instance of Bobby.
+ *
+ * @param filePath location in a directory where contents will be stored.
+ */
+ public Bobby(String filePath) {
+ storage = new Storage(filePath);
+ tasks = new TaskList(storage.createTaskArray(), storage);
+ }
+
+ public String getResponse(String text) {
+ return Parser.parse(tasks, text);
+ }
+}
diff --git a/src/main/java/bobby/BobbyException.java b/src/main/java/bobby/BobbyException.java
new file mode 100644
index 0000000000..f10c8f2e00
--- /dev/null
+++ b/src/main/java/bobby/BobbyException.java
@@ -0,0 +1,7 @@
+package bobby;
+
+public class BobbyException extends Exception {
+ public BobbyException(String errorMessage) {
+ super(errorMessage);
+ }
+}
diff --git a/src/main/java/bobby/Commands.java b/src/main/java/bobby/Commands.java
new file mode 100644
index 0000000000..71487245d4
--- /dev/null
+++ b/src/main/java/bobby/Commands.java
@@ -0,0 +1,5 @@
+package bobby;
+
+public enum Commands {
+ BYE, LIST, MARK, UNMARK, TODO, DEADLINE, EVENT, DELETE, FIND, UNDO
+}
diff --git a/src/main/java/bobby/Deadline.java b/src/main/java/bobby/Deadline.java
new file mode 100644
index 0000000000..8dcbb12173
--- /dev/null
+++ b/src/main/java/bobby/Deadline.java
@@ -0,0 +1,31 @@
+package bobby;
+
+import java.io.FileWriter;
+import java.io.IOException;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+
+public class Deadline extends Task {
+ protected LocalDate date;
+
+ /**
+ * Constructor to create an instance of Deadline.
+ *
+ * @param description description of the Deadline Task to be done.
+ * @param date deadline in which task needs to be done in YYYY-MM-DD format.
+ */
+ public Deadline(String description, LocalDate date) {
+ super(description);
+ this.date = date;
+ }
+
+ @Override
+ public void writeToFile(FileWriter fw) throws IOException {
+ fw.write("D ; " + isDone + " ; " + description + " ; " + date + System.lineSeparator());
+ }
+
+ @Override
+ public String toString() {
+ return "[D]" + super.toString() + " (by: " + date.format(DateTimeFormatter.ofPattern("MMM d yyyy")) + ")";
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/bobby/DialogBox.java b/src/main/java/bobby/DialogBox.java
new file mode 100644
index 0000000000..92276a7924
--- /dev/null
+++ b/src/main/java/bobby/DialogBox.java
@@ -0,0 +1,49 @@
+package bobby;
+
+import javafx.geometry.Pos;
+import javafx.scene.control.Label;
+import javafx.scene.image.ImageView;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.Node;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Region;
+
+public class DialogBox extends HBox {
+
+ private Label text;
+ private ImageView displayPicture;
+
+ public DialogBox(Label l, ImageView iv) {
+ text = l;
+ displayPicture = iv;
+
+ text.setWrapText(true);
+ displayPicture.setFitWidth(100.0);
+ displayPicture.setFitHeight(100.0);
+
+ this.setAlignment(Pos.TOP_RIGHT);
+ this.getChildren().addAll(text, displayPicture);
+ }
+
+ /**
+ * Flips the dialog box such that the ImageView is on the left and text on the right.
+ */
+ private void flip() {
+ this.setAlignment(Pos.TOP_LEFT);
+ ObservableList tmp = FXCollections.observableArrayList(this.getChildren());
+ FXCollections.reverse(tmp);
+ this.getChildren().setAll(tmp);
+ }
+
+ public static DialogBox getUserDialog(Label l, ImageView iv) {
+ return new DialogBox(l, iv);
+ }
+
+ public static DialogBox getDukeDialog(Label l, ImageView iv) {
+ var db = new DialogBox(l, iv);
+ db.flip();
+ db.setMinHeight(Region.USE_PREF_SIZE);
+ return db;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/bobby/Event.java b/src/main/java/bobby/Event.java
new file mode 100644
index 0000000000..27945c4cc5
--- /dev/null
+++ b/src/main/java/bobby/Event.java
@@ -0,0 +1,29 @@
+package bobby;
+
+import java.io.FileWriter;
+import java.io.IOException;
+
+public class Event extends Task {
+ protected String at;
+
+ /**
+ * Constructor to create an instance of Event.
+ *
+ * @param description description of the task.
+ * @param at date/time of the occurrence of the Event.
+ */
+ public Event(String description, String at) {
+ super(description);
+ this.at = at;
+ }
+
+ @Override
+ public void writeToFile(FileWriter fw) throws IOException {
+ fw.write("E ; " + isDone + " ; " + description + " ; " + at + System.lineSeparator());
+ }
+
+ @Override
+ public String toString() {
+ return "[E]" + super.toString() + " (at: " + at + ")";
+ }
+}
diff --git a/src/main/java/bobby/Launcher.java b/src/main/java/bobby/Launcher.java
new file mode 100644
index 0000000000..89ce5b8eec
--- /dev/null
+++ b/src/main/java/bobby/Launcher.java
@@ -0,0 +1,12 @@
+package bobby;
+
+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/bobby/Main.java b/src/main/java/bobby/Main.java
new file mode 100644
index 0000000000..3ed7f45a65
--- /dev/null
+++ b/src/main/java/bobby/Main.java
@@ -0,0 +1,30 @@
+package bobby;
+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 Bobby bobby = new Bobby("bobby.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().setBobby(bobby);
+ stage.show();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/bobby/MainWindow.java b/src/main/java/bobby/MainWindow.java
new file mode 100644
index 0000000000..a5aa9f4ece
--- /dev/null
+++ b/src/main/java/bobby/MainWindow.java
@@ -0,0 +1,66 @@
+package bobby;
+
+import javafx.application.Platform;
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.control.TextField;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+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 Bobby bobby;
+
+ private final Image USER_IMAGE = new Image(this.getClass().getResourceAsStream("/images/Stickman.png"));
+ private final Image BOBBY_IMAGE = new Image(this.getClass().getResourceAsStream("/images/Bobby.png"));
+
+ @FXML
+ public void initialize() {
+ scrollPane.vvalueProperty().bind(dialogContainer.heightProperty());
+ Label welcome = new Label(Ui.showWelcome());
+ ImageView bobbyIv = new ImageView(BOBBY_IMAGE);
+ dialogContainer.getChildren().add(DialogBox.getDukeDialog(welcome, bobbyIv));
+ }
+
+ public void setBobby(Bobby b) {
+ bobby = b;
+ }
+
+ /**
+ * Creates two dialog boxes, one with the user input and the other containing Bobby's reply and then appends them to
+ * the dialog container. Clears the user input after processing.
+ */
+ @FXML
+ private void handleUserInput() {
+ String userInputString = userInput.getText();
+ Label userText = new Label(userInputString);
+ Label dukeText = new Label(bobby.getResponse(userInput.getText()));
+ ImageView userIv = new ImageView();
+ ImageView bobbyIv = new ImageView();
+ userIv.setImage(USER_IMAGE);
+ bobbyIv.setImage(BOBBY_IMAGE);
+ dialogContainer.getChildren().addAll(
+ DialogBox.getUserDialog(userText, userIv),
+ DialogBox.getDukeDialog(dukeText, bobbyIv)
+ );
+ if (userInputString.equals("bye")) {
+ Platform.exit();
+ }
+
+ userInput.clear();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/bobby/Parser.java b/src/main/java/bobby/Parser.java
new file mode 100644
index 0000000000..81757a6d91
--- /dev/null
+++ b/src/main/java/bobby/Parser.java
@@ -0,0 +1,94 @@
+package bobby;
+
+import java.time.format.DateTimeParseException;
+
+/**
+ * The Parser class deals with converting user input into commands
+ * understood by the program and executes them accordingly.
+ */
+public class Parser {
+
+ private static String splitInputToCommand(String input) {
+ return input.split(" ", 2)[0];
+ }
+
+ private static int splitInputToIndex(String input) {
+ return Integer.parseInt(input.split(" ", 2)[1]) - 1;
+ }
+
+ private static String[] splitInputToQuery(String input) {
+ return input.split(" ", 2)[1].split(" ");
+ }
+
+ /**
+ * Converts user input into commands, passes the commands to TaskList
+ * to be executed, or terminates the Bobby program.
+ *
+ * @param tasks TaskList that handles the execution of commands.
+ * @param userInput user input to be parsed.
+ */
+ public static String parse(TaskList tasks, String userInput) {
+ String command = splitInputToCommand(userInput);
+ String result;
+ try {
+ switch (Commands.valueOf(command.toUpperCase())) {
+ case BYE:
+ result = Ui.printExit();
+ break;
+ case LIST:
+ result = tasks.list();
+ break;
+ case MARK:
+ int i = splitInputToIndex(userInput);
+ result = tasks.mark(i);
+ break;
+ case UNMARK:
+ int k = splitInputToIndex(userInput);
+ result = tasks.unmark(k);
+ break;
+ case TODO:
+ result = tasks.addToDo(userInput);
+ break;
+ case DEADLINE:
+ try {
+ result = tasks.addDeadline(userInput);
+ } catch (DateTimeParseException e) {
+ result = Ui.dateFormatError();
+ }
+ break;
+ case EVENT:
+ result = tasks.addEvent(userInput);
+ break;
+ case DELETE:
+ int j = splitInputToIndex(userInput);
+ result = tasks.delete(j);
+ break;
+ case FIND:
+ String[] queries = splitInputToQuery(userInput);
+ if (queries.length > 1) {
+ result = Ui.findError();
+ } else {
+ String query = queries[0];
+ result = tasks.find(query);
+ }
+ break;
+ case UNDO:
+ try {
+ tasks.undo();
+ result = Ui.printUndo();
+ } catch (BobbyException e) {
+ result = Ui.printUndoError();
+ }
+ break;
+ default:
+ result = Ui.invalidInput();
+ }
+ } catch (IllegalArgumentException e) {
+ result = Ui.invalidInput();
+ } catch (BobbyException e) {
+ result = e.toString();
+ }
+ assert !result.equals(null) : "result uninitialized";
+ return result;
+ }
+}
diff --git a/src/main/java/bobby/State.java b/src/main/java/bobby/State.java
new file mode 100644
index 0000000000..4006f098f9
--- /dev/null
+++ b/src/main/java/bobby/State.java
@@ -0,0 +1,21 @@
+package bobby;
+
+import java.util.ArrayList;
+
+/**
+ * Represents a state of the program at any point in time. In current
+ * implementation, State is represented by the arraylist of tasks.
+ */
+public class State {
+ private ArrayList taskArray;
+
+ public State (ArrayList taskArray) {
+ this.taskArray = taskArray;
+ }
+
+ public ArrayList loadState() {
+ ArrayList taskArrayCopy = new ArrayList(taskArray);
+ return taskArrayCopy;
+ }
+
+}
diff --git a/src/main/java/bobby/Storage.java b/src/main/java/bobby/Storage.java
new file mode 100644
index 0000000000..799dee718c
--- /dev/null
+++ b/src/main/java/bobby/Storage.java
@@ -0,0 +1,99 @@
+package bobby;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.Scanner;
+
+/**
+ * Storage deals with loading tasks from file and saving tasks in the file.
+ */
+public class Storage {
+ private File file;
+
+ /**
+ * Constructor to create a Storage instance.
+ *
+ * @param filePath file path where the .txt file is loaded from or created.
+ */
+ public Storage(String filePath) {
+ this.file = new File(filePath);
+ }
+
+ private ArrayList loadFile(File file, ArrayList taskArray) throws FileNotFoundException {
+ Scanner s = new Scanner(file);
+ while (s.hasNext()) {
+ String line = s.nextLine();
+ String[] inputs = line.split(" ; ");
+ switch (inputs[0]) {
+ case "T":
+ Todo newToDo = new Todo(inputs[2]);
+ if (inputs[1].equals("true")) {
+ newToDo.markAsDone();
+ }
+ taskArray.add(newToDo);
+ break;
+ case "D":
+ Deadline newDeadline = new Deadline(inputs[2], LocalDate.parse(inputs[3]));
+ if (inputs[1].equals("true")) {
+ newDeadline.markAsDone();
+ }
+ taskArray.add(newDeadline);
+ break;
+ case "E":
+ Event newEvent = new Event(inputs[2], inputs[3]);
+ if (inputs[1].equals("true")) {
+ newEvent.markAsDone();
+ }
+ taskArray.add(newEvent);
+ break;
+ default:
+ assert false;
+ }
+ }
+ return taskArray;
+ }
+
+ /**
+ * Loads file from given file path if file exists. Creates an empty file
+ * if file does not exist.
+ *
+ * @return ArrayList of tasks loaded from file.
+ */
+ public ArrayList createTaskArray() {
+ ArrayList taskArray = new ArrayList();
+ try {
+ if (!file.createNewFile()) {
+ loadFile(file, taskArray);
+ }
+ assert file.exists() : "File not found error.";
+ } catch (IOException e) {
+ System.out.println("File loading error");
+ assert false;
+ }
+ return taskArray;
+ }
+
+ /**
+ * Writes into the file with current list of tasks.
+ *
+ * @param taskArray ArrayList of current tasks to be written into file.
+ */
+ public void updateFile(ArrayList taskArray) {
+ assert file.exists() : "file does not exist";
+ try {
+ FileWriter fw = new FileWriter("bobby.txt");
+ for (int i = 0; i < taskArray.size(); i++) {
+ Task t = taskArray.get(i);
+ t.writeToFile(fw);
+ }
+ fw.close();
+ } catch (IOException e) {
+ System.out.println("Error with updating file's contents");
+ }
+ }
+}
diff --git a/src/main/java/bobby/Task.java b/src/main/java/bobby/Task.java
new file mode 100644
index 0000000000..6bb3fe6d2e
--- /dev/null
+++ b/src/main/java/bobby/Task.java
@@ -0,0 +1,38 @@
+package bobby;
+
+import java.io.FileWriter;
+import java.io.IOException;
+
+public abstract class Task {
+ protected String description;
+ protected boolean isDone;
+
+ /**
+ * Constructor to create an instance of Task.
+ *
+ * @param description description of the Task to be done.
+ */
+ public Task(String description) {
+ this.description = description;
+ this.isDone = false;
+ }
+
+ public String getStatusIcon() {
+ return (isDone ? "X" : " ");
+ }
+
+ public void markAsDone() {
+ this.isDone = true;
+ }
+
+ public void unmarkAsDone() {
+ this.isDone = false;
+ }
+
+ public abstract void writeToFile(FileWriter fw) throws IOException;
+
+ @Override
+ public String toString() {
+ return "[" + this.getStatusIcon() + "] " + this.description;
+ }
+}
diff --git a/src/main/java/bobby/TaskList.java b/src/main/java/bobby/TaskList.java
new file mode 100644
index 0000000000..a8dd07c0c5
--- /dev/null
+++ b/src/main/java/bobby/TaskList.java
@@ -0,0 +1,224 @@
+package bobby;
+
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.Objects;
+import java.util.Stack;
+
+/**
+ * The TaskList class executes commands and updates the list accordingly.
+ */
+public class TaskList {
+ private ArrayList taskArray;
+ private Stack stateStack;
+ private State currentState;
+ private Storage storage;
+
+ /**
+ * Constructor to create an instance of TaskList.
+ *
+ * @param taskArray ArrayList storing Tasks.
+ * @param storage used to update the list stored in the .txt file.
+ */
+ public TaskList(ArrayList taskArray, Storage storage) {
+ this.stateStack = new Stack();
+ stateStack.push(new State(new ArrayList(taskArray)));
+ this.taskArray = taskArray;
+ this.storage = storage;
+ }
+
+ /**
+ * Adds a Task of type Todo.
+ *
+ * @param task description of the task.
+ * @return Program output to confirm execution of command to user.
+ * @throws BobbyException if the description of the task is empty.
+ */
+ public String addToDo(String task) throws BobbyException {
+ String[] inputs = task.split(" ", 2);
+ if (inputs.length <= 1) {
+ throw new BobbyException("Description cannot be empty.");
+ }
+
+ Todo newTodo = new Todo(inputs[1]);
+ taskArray.add(newTodo);
+ storage.updateFile(taskArray);
+ updateStateArray();
+
+ return Ui.printAddedTask(newTodo, taskArray);
+ }
+
+ /**
+ * Adds a Task of type Deadline.
+ *
+ * @param task description of Deadline and when the task has to be completed in YYYY-MM-DD format.
+ * @return Program output to confirm execution of command to user.
+ * @throws BobbyException when description is empty or date format is invalid.
+ */
+ public String addDeadline(String task) throws BobbyException {
+ String[] inputs = task.split(" ", 2);
+ if (inputs.length <= 1) {
+ throw new BobbyException("Description cannot be empty.");
+ }
+
+ String[] descAndDate = inputs[1].split(" /by ", 2);
+ if (descAndDate.length <= 1) {
+ throw new BobbyException("Invalid date format. Please use YYYY-MM-DD.");
+ }
+
+ String description = descAndDate[0];
+ LocalDate by = LocalDate.parse(descAndDate[1]);
+ Deadline newDeadline = new Deadline(description, by);
+ taskArray.add(newDeadline);
+ storage.updateFile(taskArray);
+ updateStateArray();
+
+ return Ui.printAddedTask(newDeadline, taskArray);
+ }
+
+ /**
+ * Adds a Task of type Event.
+ *
+ * @param task description of Event and date/time of the Event.
+ * @return Program output to confirm execution of command to user.
+ * @throws BobbyException when description or date/time is empty.
+ */
+ public String addEvent(String task) throws BobbyException {
+ String[] inputs = task.split(" ", 2);
+ if (inputs.length <= 1) {
+ throw new BobbyException("Description cannot be empty");
+ }
+
+ String[] descAndTime = inputs[1].split(" /at ", 2);
+ if (descAndTime.length <= 1) {
+ throw new BobbyException("Date/Time format of Event is incorrect or empty");
+ }
+
+ String description = descAndTime[0];
+ String at = descAndTime[1];
+ Event newEvent = new Event(description, at);
+ taskArray.add(newEvent);
+ storage.updateFile(taskArray);
+ updateStateArray();
+
+ return Ui.printAddedTask(newEvent, taskArray);
+ }
+
+ /**
+ * deletes Removes Task of index given in user input from the list.
+ *
+ * @param index index of task to be deleted.
+ * @return Program output to confirm execution of command to user.
+ * @throws BobbyException when no given index or when index is bigger than list.
+ */
+ public String delete(int index) throws BobbyException {
+ if (index > taskArray.size() - 1 || index < 0) {
+ throw new BobbyException("Invalid index given to Bobby.");
+ }
+
+ Task t = taskArray.get(index);
+ taskArray.remove(index);
+ storage.updateFile(taskArray);
+ updateStateArray();
+
+ return Ui.printDeletedTask(t, taskArray);
+ }
+
+ /**
+ * Generates a list of current tasks.
+ *
+ * @return List of all the tasks stored in Bobby.
+ */
+ public String list() {
+ return Ui.printList(taskArray);
+ }
+
+
+ /**
+ * Marks a task as done.
+ *
+ * @param index index of task to be marked as done.
+ * @return Program output to confirm execution of command to user.
+ * @throws BobbyException when index given exceeds size of list.
+ */
+ public String mark(int index) throws BobbyException {
+ if (index > taskArray.size() - 1 || index < 0) {
+ throw new BobbyException("Invalid index given to Bobby.");
+ }
+
+ Task t = taskArray.get(index);
+ t.markAsDone();
+ storage.updateFile(taskArray);
+ updateStateArray();
+ assert t.isDone : "error in mark";
+
+ return Ui.taskDone(t);
+ }
+
+
+ /**
+ * Unmarks a task as done.
+ *
+ * @param index index of task to be unmarked.
+ * @return Program output to confirm execution of command to user.
+ * @throws BobbyException when index given exceeds size of list.
+ */
+ public String unmark(int index) throws BobbyException {
+ if (index > taskArray.size() - 1 || index < 0) {
+ throw new BobbyException("Invalid index given to Bobby.");
+ }
+
+ Task t = taskArray.get(index);
+ t.unmarkAsDone();
+ storage.updateFile(taskArray);
+ updateStateArray();
+ assert !t.isDone : "error in unmark";
+
+ return Ui.taskNotDone(t);
+ }
+
+ /**
+ * Find a task by searching for a key word.
+ *
+ * @param query keyword used to search.
+ * @return List of tasks that matches with given query keyword.
+ */
+ public String find(String query) {
+ boolean isSuccessful = false;
+ ArrayList resultTasks = new ArrayList<>();
+ for (Task t : taskArray) {
+ String[] contents = t.description.split(" ");
+ for (String content : contents) {
+ if (Objects.equals(content, query)) {
+ resultTasks.add(t);
+ isSuccessful = true;
+ }
+ }
+ }
+ if (!isSuccessful) {
+ return Ui.printNoTasksFound();
+ }
+ return Ui.printFoundTasks(resultTasks);
+ }
+
+ private void updateStateArray() {
+ ArrayList taskArrayCopy = new ArrayList(taskArray);
+ currentState = new State(taskArrayCopy);
+ stateStack.push(currentState);
+ }
+
+ /**
+ * Undo previous change to the list of tasks stored in Bobby.
+ *
+ * @throws BobbyException when there is no more changes to be reversed.
+ */
+ public void undo() throws BobbyException {
+ if (stateStack.size() <= 1) {
+ throw new BobbyException("Bobby cannot Undo any further.");
+ }
+ stateStack.pop();
+ currentState = stateStack.peek();
+ taskArray = currentState.loadState();
+ storage.updateFile(taskArray);
+ }
+}
diff --git a/src/main/java/bobby/Todo.java b/src/main/java/bobby/Todo.java
new file mode 100644
index 0000000000..33f4fdd547
--- /dev/null
+++ b/src/main/java/bobby/Todo.java
@@ -0,0 +1,21 @@
+package bobby;
+
+import java.io.FileWriter;
+import java.io.IOException;
+
+public class Todo extends Task {
+
+ public Todo(String description) {
+ super(description);
+ }
+
+ @Override
+ public void writeToFile(FileWriter fw) throws IOException {
+ fw.write("T ; " + isDone + " ; " + description + System.lineSeparator());
+ }
+
+ @Override
+ public String toString() {
+ return "[T]" + super.toString();
+ }
+}
diff --git a/src/main/java/bobby/Ui.java b/src/main/java/bobby/Ui.java
new file mode 100644
index 0000000000..d8061796c9
--- /dev/null
+++ b/src/main/java/bobby/Ui.java
@@ -0,0 +1,82 @@
+package bobby;
+
+import java.util.ArrayList;
+
+public class Ui {
+
+ public static String showWelcome() {
+ return "Bobby greets you. Bobby is here to help.";
+ }
+
+ /**
+ * Prints the tasks currently in the list of tasks.
+ * @param taskArray ArrayList containing current tasks to be printed.
+ */
+ public static String printList(ArrayList taskArray) {
+ int count = 0;
+ String result = "Here is what you told Bobby:" + System.lineSeparator();
+ for (int i = 0; i < taskArray.size(); i++) {
+ Task t = taskArray.get(i);
+ count = i + 1;
+ result = result + count + "." + t.toString() + System.lineSeparator();
+ }
+ assert count == taskArray.size();
+ return result;
+ }
+
+ public static String printExit() {
+ return "Bobby bids you farewell.";
+ }
+
+ public static String taskDone(Task t) {
+ return "Bobby applauds you. This task is done:\n" + t.toString();
+ }
+
+ public static String taskNotDone(Task t) {
+ return "Bobby will remember that this task is not yet done:\n" + t.toString();
+ }
+
+ public static String findError() {
+ return "Bobby can only search using 1 keyword.";
+ }
+
+ public static String dateFormatError() {
+ return "Invalid date format. Please use YYYY-MM-DD.";
+ }
+
+ public static String invalidInput() {
+ return "Bobby did not understand you. Please use valid inputs.";
+ }
+ public static String printAddedTask(Task t, ArrayList taskArray) {
+ return "Bobby heard: " + t.toString() + System.lineSeparator() + "Bobby remembers "
+ + taskArray.size() + " tasks(s).";
+
+ }
+
+ public static String printDeletedTask(Task t, ArrayList taskArray) {
+ return "Bobby has forgotten this task:\n" + t.toString() + System.lineSeparator()
+ + "Bobby remembers " + taskArray.size() + " task(s).";
+ }
+
+ public static String printFoundTasks(ArrayList taskArray) {
+ String result = "Bobby found these task(s):" + System.lineSeparator();
+ for (int i = 0; i < taskArray.size(); i++) {
+ Task t = taskArray.get(i);
+ int count = i + 1;
+ result = result + count + "." + t.toString() + System.lineSeparator();
+ }
+ return result;
+ }
+
+ public static String printUndo() {
+ return "Bobby has forgotten your previous change.";
+ }
+
+ public static String printUndoError() {
+ return "Bobby cannot Undo any further.";
+ }
+
+ public static String printNoTasksFound() {
+ return "Bobby could not find any matching tasks.";
+ }
+}
diff --git a/src/main/resources/images/Bobby.png b/src/main/resources/images/Bobby.png
new file mode 100644
index 0000000000..d111b80026
Binary files /dev/null and b/src/main/resources/images/Bobby.png differ
diff --git a/src/main/resources/images/Stickman.png b/src/main/resources/images/Stickman.png
new file mode 100644
index 0000000000..c7a381f89e
Binary files /dev/null and b/src/main/resources/images/Stickman.png differ
diff --git a/src/main/resources/view/DialogBox.fxml b/src/main/resources/view/DialogBox.fxml
new file mode 100644
index 0000000000..ede775d4f9
--- /dev/null
+++ b/src/main/resources/view/DialogBox.fxml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml
new file mode 100644
index 0000000000..c643951932
--- /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/ParserTest.java b/src/test/java/ParserTest.java
new file mode 100644
index 0000000000..ee9d410cf7
--- /dev/null
+++ b/src/test/java/ParserTest.java
@@ -0,0 +1,53 @@
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import bobby.Bobby;
+import bobby.Parser;
+import bobby.Storage;
+import bobby.Task;
+import bobby.TaskList;
+
+class ParserTest {
+ private final ByteArrayOutputStream outputStreamCaptor = new ByteArrayOutputStream();
+ private final PrintStream standardOut = System.out;
+
+ @BeforeEach
+ public void setUp() {
+ System.setOut(new PrintStream(outputStreamCaptor));
+ }
+
+ @AfterEach
+ public void tearDown() {
+ System.setOut(standardOut);
+ }
+
+ @Test
+ public void testInputToDo() throws IOException {
+ Parser.parse(new TaskList(new ArrayList(), new Storage("bobby.txt")), "todo 2103 iP");
+ assertEquals("Bobby heard: [T][ ] 2103 iP" + System.lineSeparator()
+ + "Bobby remembers 1 task(s).", outputStreamCaptor.toString().trim());
+ }
+
+ @Test
+ public void testInputDeadLine() throws IOException {
+ Parser.parse(new TaskList(new ArrayList(), new Storage("bobby.txt")),
+ "deadline cs2106 quiz /by 2022-01-31");
+ assertEquals("Bobby heard: [D][ ] cs2106 quiz (by: Jan 31 2022)" + System.lineSeparator()
+ + "Bobby remembers 1 task(s).", outputStreamCaptor.toString().trim());
+ }
+
+ @Test
+ public void parseInputs_invalidInputs_bobbyExceptionThrown() throws IOException {
+ Parser.parse(new TaskList(new ArrayList(), new Storage("bobby.txt")), "random input");
+ assertEquals("Bobby does not understand you. Please use valid inputs.",
+ outputStreamCaptor.toString().trim());
+ }
+}
\ No newline at end of file
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 657e74f6e7..d52c1c3eb5 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,7 +1,17 @@
-Hello from
- ____ _
-| _ \ _ _| | _____
-| | | | | | | |/ / _ \
-| |_| | |_| | < __/
-|____/ \__,_|_|\_\___|
-
+Bobby greets you. Bobby is here to help.
+Bobby heard: [T][ ] finish 2103 project tab
+Bobby remembers 1 task(s).
+Bobby heard: [D][ ] do daily exercise (by: the end of the day)
+Bobby remembers 2 task(s).
+Here is what you told Bobby:
+1.[T][ ] finish 2103 project tab
+2.[D][ ] do daily exercise (by: the end of the day)
+Bobby heard: [E][ ] global game jam (at: 21 January 1830 hours)
+Bobby remembers 3 task(s).
+Bobby applauds you. This task is done:
+[D][X] do daily exercise (by: the end of the day)
+Here is what you told Bobby:
+1.[T][ ] finish 2103 project tab
+2.[D][X] do daily exercise (by: the end of the day)
+3.[E][ ] global game jam (at: 21 January 1830 hours)
+Bobby bids you farewell.
\ No newline at end of file
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index e69de29bb2..9e5d9b50af 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -0,0 +1,7 @@
+todo finish 2103 project tab
+deadline do daily exercise /by the end of the day
+list
+event global game jam /at 21 January 1830 hours
+mark 2
+list
+bye
\ No newline at end of file
diff --git a/text-ui-test/runtest.bat b/text-ui-test/runtest.bat
index 0873744649..da60661925 100644
--- a/text-ui-test/runtest.bat
+++ b/text-ui-test/runtest.bat
@@ -15,7 +15,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 Bobby < 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