diff --git a/Duke.txt b/Duke.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/DukeList.txt b/DukeList.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/Duke_List.txt b/Duke_List.txt
new file mode 100644
index 0000000000..f724022b56
--- /dev/null
+++ b/Duke_List.txt
@@ -0,0 +1,3 @@
+D @ 0 @ project @ 12/12/2012 1200
+T @ 0 @ borrow a chinese book
+E @ 0 @ project meeting @ 12/12/0012 1100
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000000..99d4298af6
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,38 @@
+plugins {
+ id 'java'
+ id 'application'
+ id 'org.openjfx.javafxplugin' version '0.0.7'
+ id 'com.github.johnrengelman.shadow' version '5.1.0'
+ id 'checkstyle'
+}
+
+group 'seedu.duke'
+version '0.1.0'
+
+repositories {
+ mavenCentral()
+}
+
+checkstyle {
+ toolVersion = '8.23'
+}
+
+javafx {
+ version = "11.0.2"
+ modules = [ 'javafx.controls', 'javafx.fxml' ]
+}
+
+application {
+ // Change this to your main class.
+ mainClassName = "Launcher"
+}
+run {
+ standardInput = System.in
+}
+
+shadowJar {
+ archiveBaseName = "duke"
+ archiveVersion = "0.1"
+ archiveClassifier = null
+ archiveAppendix = null
+}
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000000..b1a57ba6c0
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,257 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/README.md b/docs/README.md
index fd44069597..e2a5053d4d 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -3,18 +3,81 @@
## Features
### Feature 1
-Description of feature.
+Shows you your current list of tasks.
## Usage
-### `Keyword` - Describe action
+### `list` - Display current list of tasks.
-Describe action and its outcome.
+Example of usage:
+
+`list`
+
+### Feature 2
+Adds a task into the list of tasks. Dates and times are to be input as the following format:
+`DD/MM/YYYY HHMM`
+
+## Usage
+
+### `todo [description]` - Adds a todo task into the list with the description.
+
+### `event [description] /at [date time]` - Adds an event task into the list with the description, date and time.
+
+### `deadline [description] /by [date time]` - Adds a deadline task into the list with the description, date and time.
Example of usage:
-`keyword (optional arguments)`
+`todo read book`
+
+`event project meeting /at 20/12/2019 1600`
+
+`deadline homework /by 15/10/2019 2359`
+
+### Feature 3
+Deletes a task from the list of tasks.
+
+## Usage
+
+### `delete [index]` - Removes a task from the list at the given index.
+
+Example of usage:
+
+`delete 2` - Deletes the 2nd task in the list.
+
+### Feature 4
+Find a task from the list of tasks with a given keyword.
+
+## Usage
+
+### `find [keyword]` - Displays a list of tasks with the given keyword from the current list of tasks.
+
+Examples of usage:
+
+`find book` - Returns a list of tasks with the word 'book'.
+
+### Feature 5
+Mark a task as done.
+
+## Usage
+
+### `done [index]` - Changes the cross beside the description to a tick of the task at the given index.
+
+
+Examples of usage:
+
+`done 1` - Marks the first task in the current list of tasks as done.
+
+### Feature 6
+Update the description or date and time of a task. Dates and times are to be input as the following format:
+`DD/MM/YYYY HHMM`
+
+
+## Usage
+
+### `update [description/date] of [task description] /to [new description/date time]`
+
+Examples of usage:
-Expected outcome:
+`update description of borrow book /to borrow a Chinese book`
-`outcome`
+`update date of project meeting /to 12/12/2012 1200`
diff --git a/docs/Ui.png b/docs/Ui.png
new file mode 100644
index 0000000000..fa30efb55b
Binary files /dev/null and b/docs/Ui.png differ
diff --git a/duke-0.1.jar b/duke-0.1.jar
new file mode 100644
index 0000000000..cfa45ac886
Binary files /dev/null and b/duke-0.1.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000..87b738cbd0
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..bff0b6fb42
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Aug 29 15:31:54 SGT 2019
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000000..af6708ff22
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## 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"'
+
+# 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, switch paths to Windows format before running java
+if $cygwin ; 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=$((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"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000000..6d57edc706
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@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 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"
+
+@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/settings.gradle b/settings.gradle
new file mode 100644
index 0000000000..d1e92fe5db
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'duke'
diff --git a/src/main/java/AddCommand.class b/src/main/java/AddCommand.class
new file mode 100644
index 0000000000..48704761fe
Binary files /dev/null and b/src/main/java/AddCommand.class differ
diff --git a/src/main/java/AddCommand.java b/src/main/java/AddCommand.java
new file mode 100644
index 0000000000..d4d9b1a5c3
--- /dev/null
+++ b/src/main/java/AddCommand.java
@@ -0,0 +1,24 @@
+/**
+ * Represents the command to add a task into the arraylist.
+ */
+
+
+public class AddCommand extends Command {
+ private Task task;
+
+ public AddCommand(Task task) {
+ this.task = task;
+ }
+
+ @Override
+ public String execute(TaskList tasks, Ui ui, Storage storage) {
+ tasks.getList().add(task);
+ storage.writeFile(tasks.getList());
+ return toString() + ui.printTask(tasks.getList().size(), task);
+ }
+
+ @Override
+ public String toString() {
+ return "Got it. I've added this task:\n";
+ }
+}
diff --git a/src/main/java/Command.class b/src/main/java/Command.class
new file mode 100644
index 0000000000..d56a9e9ca7
Binary files /dev/null and b/src/main/java/Command.class differ
diff --git a/src/main/java/Command.java b/src/main/java/Command.java
new file mode 100644
index 0000000000..bd8a5f1621
--- /dev/null
+++ b/src/main/java/Command.java
@@ -0,0 +1,15 @@
+/**
+ * Abstract class to represent the possible commands given to Duke.
+ */
+
+public abstract class Command {
+
+ /**
+ * Executes the different commands respectively.
+ * @param tasks Arraylist of tasks.
+ * @param ui User interaction that comes with the command.
+ * @param storage To deal with saving tasks into the file after executing the command.
+ */
+ public abstract String execute(TaskList tasks, Ui ui, Storage storage);
+
+}
diff --git a/src/main/java/Deadline.class b/src/main/java/Deadline.class
new file mode 100644
index 0000000000..33a1b90d7d
Binary files /dev/null and b/src/main/java/Deadline.class differ
diff --git a/src/main/java/Deadline.java b/src/main/java/Deadline.java
new file mode 100644
index 0000000000..87ac2bbe68
--- /dev/null
+++ b/src/main/java/Deadline.java
@@ -0,0 +1,44 @@
+/**
+ * Deadline class to represent a task with a date to be done by.
+ */
+
+import java.text.ParseException;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+
+public class Deadline extends Task {
+
+ protected Date date;
+
+ public Deadline(String description, String by) throws ParseException {
+ super(description);
+ this.date = new SimpleDateFormat("dd/MM/yyyy HHmm").parse(by);
+ }
+
+ public Deadline(String description, boolean isDone, String by) throws ParseException {
+ super(description, isDone);
+ this.date = new SimpleDateFormat("dd/MM/yyyy HHmm").parse(by);
+ }
+
+ @Override
+ public String toString() {
+ SimpleDateFormat formatter = new SimpleDateFormat("d MMMM yyyy, hmma");
+ String formattedDate = formatter.format(this.date);
+ return "[D]" + super.toString() + " (by: " + formattedDate + ")";
+ }
+
+ @Override
+ public String print() {
+ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HHmm");
+ String formattedDate = formatter.format(this.date);
+ if (this.isDone) {
+ return "D @ 1 @ " + this.description + " @ " + formattedDate;
+ } else {
+ return "D @ 0 @ " + this.description + " @ " + formattedDate;
+ }
+ }
+
+ public void setDate(Date newDate) {
+ this.date = newDate;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/DeleteCommand.class b/src/main/java/DeleteCommand.class
new file mode 100644
index 0000000000..cccc5b0a03
Binary files /dev/null and b/src/main/java/DeleteCommand.class differ
diff --git a/src/main/java/DeleteCommand.java b/src/main/java/DeleteCommand.java
new file mode 100644
index 0000000000..e6143808a5
--- /dev/null
+++ b/src/main/java/DeleteCommand.java
@@ -0,0 +1,23 @@
+/**
+ * Represents a command to remove a task from the arraylist.
+ */
+
+public class DeleteCommand extends Command {
+ private int taskNumber;
+
+ public DeleteCommand(int taskNumber) {
+ this.taskNumber = taskNumber;
+ }
+
+ @Override
+ public String execute(TaskList tasks, Ui ui, Storage storage) {
+ Task taskRemoved = tasks.getList().remove(taskNumber);
+ storage.writeFile(tasks.getList());
+ return toString() + ui.printTask(tasks.getList().size(), taskRemoved);
+ }
+
+ @Override
+ public String toString() {
+ return "Noted. I've removed this task:\n";
+ }
+}
diff --git a/src/main/java/DialogBox.class b/src/main/java/DialogBox.class
new file mode 100644
index 0000000000..6272e85b20
Binary files /dev/null and b/src/main/java/DialogBox.class differ
diff --git a/src/main/java/DialogBox.fxml b/src/main/java/DialogBox.fxml
new file mode 100644
index 0000000000..e433809947
--- /dev/null
+++ b/src/main/java/DialogBox.fxml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/DialogBox.java b/src/main/java/DialogBox.java
new file mode 100644
index 0000000000..e7880fb6eb
--- /dev/null
+++ b/src/main/java/DialogBox.java
@@ -0,0 +1,65 @@
+import java.io.IOException;
+import java.util.Collections;
+
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.fxml.FXML;
+import javafx.fxml.FXMLLoader;
+import javafx.geometry.Pos;
+import javafx.scene.Node;
+import javafx.scene.control.Label;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.HBox;
+
+/**
+ * An example of a custom control using FXML.
+ * This control represents a dialog box consisting of an ImageView to represent the speaker's face and a label
+ * containing text from the speaker.
+ */
+public class DialogBox extends HBox {
+ @FXML
+ private Label dialog;
+ @FXML
+ private ImageView displayPicture;
+
+ private DialogBox(String text, Image img) {
+ try {
+ FXMLLoader fxmlLoader = new FXMLLoader(MainWindow.class.getResource("/view/DialogBox.fxml"));
+ fxmlLoader.setController(this);
+ fxmlLoader.setRoot(this);
+ fxmlLoader.load();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ dialog.setText(text);
+ displayPicture.setImage(img);
+ }
+
+ /**
+ * Flips the dialog box such that the ImageView is on the left and text on the right.
+ */
+ private void flip() {
+ ObservableList tmp = FXCollections.observableArrayList(this.getChildren());
+ Collections.reverse(tmp);
+ getChildren().setAll(tmp);
+ setAlignment(Pos.TOP_LEFT);
+ }
+
+ public static DialogBox getUserDialog(String text, Image img) {
+ return new DialogBox(text, img);
+ }
+
+ /**
+ * Method to return a text from Duke with a Duke image.
+ * @param text String that Duke returns
+ * @param img Image of Duke
+ * @return a DialogBox with the given text and image.
+ */
+ 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/DoneCommand.class b/src/main/java/DoneCommand.class
new file mode 100644
index 0000000000..db7e9efe27
Binary files /dev/null and b/src/main/java/DoneCommand.class differ
diff --git a/src/main/java/DoneCommand.java b/src/main/java/DoneCommand.java
new file mode 100644
index 0000000000..9b55b18c4c
--- /dev/null
+++ b/src/main/java/DoneCommand.java
@@ -0,0 +1,41 @@
+/**
+ * Represents a command that ticks off a task.
+ */
+
+public class DoneCommand extends Command {
+ private int taskNumber;
+
+ public DoneCommand(int taskNumber) {
+ this.taskNumber = taskNumber;
+ }
+
+ @Override
+ public String execute(TaskList tasks, Ui ui, Storage storage) {
+ Task taskDone = tasks.getList().get(taskNumber);
+ taskDone.markAsDone();
+ storage.writeFile(tasks.getList());
+ return toString() + " " + taskDone;
+ }
+
+ public int getTaskNumber() {
+ return taskNumber;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj == null || obj.getClass() != this.getClass()) {
+ return false;
+ } else {
+ DoneCommand command = (DoneCommand) obj;
+ return taskNumber == command.getTaskNumber();
+ }
+
+ }
+
+ @Override
+ public String toString() {
+ return "Nice! I've marked this task as done:\n";
+ }
+}
diff --git a/src/main/java/Duke.class b/src/main/java/Duke.class
new file mode 100644
index 0000000000..1724591d8d
Binary files /dev/null and b/src/main/java/Duke.class differ
diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java
index 5d313334cc..5d5dbbd975 100644
--- a/src/main/java/Duke.java
+++ b/src/main/java/Duke.java
@@ -1,10 +1,160 @@
-public class Duke {
- public static void main(String[] args) {
- String logo = " ____ _ \n"
- + "| _ \\ _ _| | _____ \n"
- + "| | | | | | | |/ / _ \\\n"
- + "| |_| | |_| | < __/\n"
- + "|____/ \\__,_|_|\\_\\___|\n";
- System.out.println("Hello from\n" + logo);
- }
-}
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.Region;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+import javafx.scene.image.Image;
+
+import java.text.ParseException;
+
+/**
+ * Main driving class for Duke.
+ */
+
+
+public class Duke extends Application {
+
+ private Storage storage;
+ private TaskList list;
+ private Ui ui;
+ private ScrollPane scrollPane;
+ private VBox dialogContainer;
+ private TextField userInput;
+ private Button sendButton;
+ private Scene scene;
+ private Image user = new Image(this.getClass().getResourceAsStream("/images/DaUser.png"));
+ private Image duke = new Image(this.getClass().getResourceAsStream("/images/DaDuke.png"));
+
+ /**
+ * Creates a new instance of Duke with the given txt file.
+ * @param file txt file to store the list of tasks.
+ */
+ public Duke(String file) {
+ ui = new Ui();
+ storage = new Storage(file);
+ list = new TaskList(storage.load());
+ }
+
+ @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();
+
+ 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);
+
+ // more code to be added here later
+ sendButton.setOnMouseClicked((event) -> {
+ dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
+ userInput.clear();
+ });
+
+ userInput.setOnAction((event) -> {
+ dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
+ userInput.clear();
+ });
+
+ 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() {
+ String input = userInput.getText();
+ String response = getResponse(input);
+ dialogContainer.getChildren().addAll(
+ DialogBox.getUserDialog(input, user),
+ DialogBox.getDukeDialog(response, duke)
+ );
+ userInput.clear();
+ }
+
+ /**
+ * You should have your own function to generate a response to user input.
+ * Replace this stub with your completed method.
+ */
+ String getResponse(String input) {
+ String response = "";
+ try {
+ Command c = Parser.parse(input);
+ response = c.execute(list, ui, storage);
+ } catch (DukeException e) {
+ response = e.getMessage();
+ } catch (ParseException e) {
+ response = "Date in wrong format";
+ }
+ return response;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/DukeException.class b/src/main/java/DukeException.class
new file mode 100644
index 0000000000..4fd37b6ec6
Binary files /dev/null and b/src/main/java/DukeException.class differ
diff --git a/src/main/java/DukeException.java b/src/main/java/DukeException.java
new file mode 100644
index 0000000000..a42af95744
--- /dev/null
+++ b/src/main/java/DukeException.java
@@ -0,0 +1,9 @@
+/**
+ * Represents exceptions specific to Duke.
+ */
+
+public class DukeException extends Exception {
+ public DukeException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/Duke_List.txt b/src/main/java/Duke_List.txt
new file mode 100644
index 0000000000..f00dc64509
--- /dev/null
+++ b/src/main/java/Duke_List.txt
@@ -0,0 +1,4 @@
+D @ 1 @ art project @ 04/04/2009 1600
+T @ 0 @ borrow book
+T @ 0 @ borrow book
+T @ 0 @ sleep
diff --git a/src/main/java/EmptyDescriptionException.class b/src/main/java/EmptyDescriptionException.class
new file mode 100644
index 0000000000..317754bcbe
Binary files /dev/null and b/src/main/java/EmptyDescriptionException.class differ
diff --git a/src/main/java/EmptyDescriptionException.java b/src/main/java/EmptyDescriptionException.java
new file mode 100644
index 0000000000..af03e38ce8
--- /dev/null
+++ b/src/main/java/EmptyDescriptionException.java
@@ -0,0 +1,9 @@
+/**
+ * An exception that occurs when a task has no description.
+ */
+
+public class EmptyDescriptionException extends DukeException {
+ public EmptyDescriptionException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/Event.class b/src/main/java/Event.class
new file mode 100644
index 0000000000..f184478cbb
Binary files /dev/null and b/src/main/java/Event.class differ
diff --git a/src/main/java/Event.java b/src/main/java/Event.java
new file mode 100644
index 0000000000..bcc27555f0
--- /dev/null
+++ b/src/main/java/Event.java
@@ -0,0 +1,44 @@
+/**
+ * Event class to represent a task that occurs on a certain date.
+ */
+
+import java.text.ParseException;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+
+public class Event extends Task {
+ protected Date date;
+
+ public Event(String description, String at) throws ParseException {
+ super(description);
+ this.date = new SimpleDateFormat("dd/MM/yyyy HHmm").parse(at);
+ }
+
+ public Event(String description, boolean isDone, String at) throws ParseException {
+ super(description, isDone);
+ this.date = new SimpleDateFormat("dd/MM/yyyy HHmm").parse(at);
+ }
+
+ @Override
+ public String toString() {
+ SimpleDateFormat formatter = new SimpleDateFormat("d MMMM yyyy, hmma");
+ String formattedDate = formatter.format(this.date);
+ return "[E]" + super.toString() + " (at: " + formattedDate + ")";
+ }
+
+ public void setDate(Date newDate) {
+ this.date = newDate;
+ }
+
+
+ @Override
+ public String print() {
+ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HHmm");
+ String formattedDate = formatter.format(this.date);
+ if (this.isDone) {
+ return "E @ 1 @ " + this.description + " @ " + formattedDate;
+ } else {
+ return "E @ 0 @ " + this.description + " @ " + formattedDate;
+ }
+ }
+}
diff --git a/src/main/java/ExitCommand.class b/src/main/java/ExitCommand.class
new file mode 100644
index 0000000000..12d1191661
Binary files /dev/null and b/src/main/java/ExitCommand.class differ
diff --git a/src/main/java/ExitCommand.java b/src/main/java/ExitCommand.java
new file mode 100644
index 0000000000..3be2e2159a
--- /dev/null
+++ b/src/main/java/ExitCommand.java
@@ -0,0 +1,11 @@
+/**
+ * Represents the command for Duke to terminate.
+ */
+
+public class ExitCommand extends Command {
+
+ @Override
+ public String execute(TaskList tasks, Ui ui, Storage storage) {
+ return "Bye. Hope to see you again soon!";
+ }
+}
diff --git a/src/main/java/FindCommand.class b/src/main/java/FindCommand.class
new file mode 100644
index 0000000000..8cf5b4f59e
Binary files /dev/null and b/src/main/java/FindCommand.class differ
diff --git a/src/main/java/FindCommand.java b/src/main/java/FindCommand.java
new file mode 100644
index 0000000000..00b1473cba
--- /dev/null
+++ b/src/main/java/FindCommand.java
@@ -0,0 +1,36 @@
+/**
+ * Represents a command that searches for a task with a given keyword.
+ */
+
+import java.util.ArrayList;
+
+public class FindCommand extends Command {
+ private String description;
+
+ public FindCommand(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public String execute(TaskList tasks, Ui ui, Storage storage) {
+ ArrayList matchingTasks = new ArrayList<>();
+ int count = 1;
+ String str = toString();
+ for (Task task : tasks.getList()) {
+ if (task.getDescription().contains(description)) {
+ matchingTasks.add(task);
+ }
+ }
+ for (Task task : matchingTasks) {
+ str += count + "." + task + "\n";
+ count++;
+ }
+
+ return str;
+ }
+
+ @Override
+ public String toString() {
+ return "Here are the matching tasks in your list:\n";
+ }
+}
diff --git a/src/main/java/Launcher.class b/src/main/java/Launcher.class
new file mode 100644
index 0000000000..16fa5404a7
Binary files /dev/null and b/src/main/java/Launcher.class differ
diff --git a/src/main/java/Launcher.java b/src/main/java/Launcher.java
new file mode 100644
index 0000000000..11dbf00c62
--- /dev/null
+++ b/src/main/java/Launcher.java
@@ -0,0 +1,10 @@
+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/ListCommand.class b/src/main/java/ListCommand.class
new file mode 100644
index 0000000000..7d91a80715
Binary files /dev/null and b/src/main/java/ListCommand.class differ
diff --git a/src/main/java/ListCommand.java b/src/main/java/ListCommand.java
new file mode 100644
index 0000000000..9d7874b710
--- /dev/null
+++ b/src/main/java/ListCommand.java
@@ -0,0 +1,23 @@
+/**
+ * Represents a command to print out the tasks in the arraylist.
+ */
+
+public class ListCommand extends Command {
+
+ @Override
+ public String execute(TaskList tasks, Ui ui, Storage storage) {
+ int listCount = 1;
+ String str = toString();
+ for (Task task : tasks.getList()) {
+ str += listCount + "." + task + "\n";
+ listCount++;
+ }
+
+ return str;
+ }
+
+ @Override
+ public String toString() {
+ return "Here are the tasks in your list:\n";
+ }
+}
diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..9f37e4e0aa
--- /dev/null
+++ b/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Duke
+
diff --git a/src/main/java/Main.class b/src/main/java/Main.class
new file mode 100644
index 0000000000..f2e0d3f0a6
Binary files /dev/null and b/src/main/java/Main.class differ
diff --git a/src/main/java/Main.java b/src/main/java/Main.java
new file mode 100644
index 0000000000..69a0afc645
--- /dev/null
+++ b/src/main/java/Main.java
@@ -0,0 +1,31 @@
+
+
+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("Duke_List.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);
+ stage.setTitle("Duke");
+ fxmlLoader.getController().setDuke(duke);
+ stage.show();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/MainWindow.class b/src/main/java/MainWindow.class
new file mode 100644
index 0000000000..6aad81d102
Binary files /dev/null and b/src/main/java/MainWindow.class differ
diff --git a/src/main/java/MainWindow.fxml b/src/main/java/MainWindow.fxml
new file mode 100644
index 0000000000..435f3ce0d8
--- /dev/null
+++ b/src/main/java/MainWindow.fxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/MainWindow.java b/src/main/java/MainWindow.java
new file mode 100644
index 0000000000..bdfa0fb8f2
--- /dev/null
+++ b/src/main/java/MainWindow.java
@@ -0,0 +1,50 @@
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.control.TextField;
+import javafx.scene.image.Image;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.VBox;
+/**
+ * Controller for MainWindow. Provides the layout for the other controls.
+ */
+
+public class MainWindow extends AnchorPane {
+ @FXML
+ private ScrollPane scrollPane;
+ @FXML
+ private VBox dialogContainer;
+ @FXML
+ private TextField userInput;
+ @FXML
+ private Button sendButton;
+
+ private Duke duke;
+
+ private Image userImage = new Image(this.getClass().getResourceAsStream("/images/DaUser.png"));
+ private Image dukeImage = new Image(this.getClass().getResourceAsStream("/images/DaDuke.png"));
+
+ @FXML
+ public void initialize() {
+ scrollPane.vvalueProperty().bind(dialogContainer.heightProperty());
+ }
+
+ public void setDuke(Duke d) {
+ duke = d;
+ }
+
+ /**
+ * Creates two dialog boxes, one echoing user input and the other containing Duke's reply and then appends them to
+ * the dialog container. Clears the user input after processing.
+ */
+ @FXML
+ private void handleUserInput() {
+ String input = userInput.getText();
+ String response = duke.getResponse(input);
+ dialogContainer.getChildren().addAll(
+ DialogBox.getUserDialog(input, userImage),
+ DialogBox.getDukeDialog(response, dukeImage)
+ );
+ userInput.clear();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/Parser.class b/src/main/java/Parser.class
new file mode 100644
index 0000000000..f2da175ad1
Binary files /dev/null and b/src/main/java/Parser.class differ
diff --git a/src/main/java/Parser.java b/src/main/java/Parser.java
new file mode 100644
index 0000000000..11de029727
--- /dev/null
+++ b/src/main/java/Parser.java
@@ -0,0 +1,83 @@
+import java.text.ParseException;
+
+/**
+ * Parser class to handle user input.
+ */
+public class Parser {
+
+ /**
+ * Parses the input string and determines the type of command given.
+ * @param str The input string supplied to Duke.
+ * @return Returns the corresponding command depending on the first word of the input string.
+ */
+ public static Command parse(String str) throws DukeException, ParseException {
+ String[] arr = str.split(" ");
+ String next = arr[0];
+ Command c;
+ switch (next) {
+ case "find":
+ c = new FindCommand(arr[1]);
+ break;
+ case "bye":
+ c = new ExitCommand();
+ break;
+ case "list":
+ c = new ListCommand();
+ break;
+ case "done":
+ c = new DoneCommand(Integer.parseInt(arr[1]) - 1);
+ break;
+ case "delete":
+ c = new DeleteCommand(Integer.parseInt(arr[1]) - 1);
+ break;
+ case "update":
+ int a = 3;
+ String taskName = "";
+ while (!arr[a].contains("/to")) {
+ taskName += " " + arr[a];
+ a++;
+ }
+ String updatedInfo = arr[a + 1];
+ for (int i = a + 2; i < arr.length; i++) {
+ updatedInfo += " " + arr[i];
+ }
+ if (arr[1].contains("description")) {
+ c = new UpdateDescriptionCommand(taskName.trim(), updatedInfo);
+ } else if (arr[1].contains("date")) {
+ c = new UpdateDateCommand(taskName.trim(), updatedInfo);
+ } else {
+ throw new UnknownTaskException("☹ OOPS!!! I'm sorry, but I don't know what that means :-(");
+ }
+ break;
+ default:
+ String description = "";
+ Task t;
+ if (next.equals("todo") || next.equals("deadline") || next.equals("event")) {
+ if (arr.length == 1) {
+ throw new EmptyDescriptionException("☹ OOPS!!! The description of a " + next + " cannot be empty.");
+ } else {
+ for (int i = 1; i < arr.length; i++) {
+ description += " " + arr[i];
+ }
+ }
+ } else {
+ throw new UnknownTaskException("☹ OOPS!!! I'm sorry, but I don't know what that means :-(");
+ }
+ if (next.equals("todo")) {
+ t = new Todos(description.trim());
+
+ } else {
+ int index = description.indexOf("/");
+ String date = description.substring(index + 4);
+ String desc = description.substring(1, index - 1);
+ if (next.equals("deadline")) {
+ t = new Deadline(desc, date);
+ } else {
+ t = new Event(desc, date);
+ }
+ }
+ c = new AddCommand(t);
+ }
+ return c;
+ }
+}
diff --git a/src/main/java/Storage.class b/src/main/java/Storage.class
new file mode 100644
index 0000000000..5f791bbd03
Binary files /dev/null and b/src/main/java/Storage.class differ
diff --git a/src/main/java/Storage.java b/src/main/java/Storage.java
new file mode 100644
index 0000000000..0b4aecc3c4
--- /dev/null
+++ b/src/main/java/Storage.java
@@ -0,0 +1,71 @@
+/**
+ * Deals with loading tasks from the file and saving tasks in the file.
+ */
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class Storage {
+ private String file;
+
+ public Storage(String file) {
+ this.file = file;
+ }
+
+ /**
+ * Method that reads the designated file and stores the content into an arraylist.
+ * Is called upon when Duke initialises.
+ * @return Returns an arraylist of tasks written in the file given the file path.
+ */
+ public ArrayList load() {
+ ArrayList list = new ArrayList<>();
+ try {
+ File f = new File(file);
+ Scanner sc = new Scanner(f);
+ Task t;
+ while (sc.hasNext()) {
+ String next = sc.nextLine();
+ String[] arr = next.split("@");
+ boolean isDone = arr[1].contains("1");
+ String description = arr[2];
+ if (arr[0].contains("T")) {
+ t = new Todos(description.trim(), isDone);
+ } else if (arr[0].contains("D")) {
+ t = new Deadline(description.trim(), isDone, arr[3].trim());
+ } else {
+ t = new Event(description.trim(), isDone, arr[3].trim());
+ }
+
+ list.add(t);
+ }
+ } catch (FileNotFoundException e) {
+ System.out.println("File not found");
+ } catch (ParseException e) {
+ System.out.println("Date in wrong format");
+ }
+ return list;
+ }
+
+ /**
+ * Rewrites the file with the new arraylist of tasks.
+ * @param list arraylist of tasks that are updated after every command given to Duke.
+ */
+ public void writeFile(ArrayList list) {
+ try {
+ FileWriter fw = new FileWriter(file);
+ String textToAdd = "";
+ for (Task task : list) {
+ textToAdd += task.print() + "\n";
+ }
+ fw.write(textToAdd);
+ fw.close();
+ } catch (IOException e) {
+ System.out.println("File not found.");
+ }
+ }
+}
diff --git a/src/main/java/Task.class b/src/main/java/Task.class
new file mode 100644
index 0000000000..a1e35e1b2a
Binary files /dev/null and b/src/main/java/Task.class differ
diff --git a/src/main/java/Task.java b/src/main/java/Task.java
new file mode 100644
index 0000000000..8664bbe4f7
--- /dev/null
+++ b/src/main/java/Task.java
@@ -0,0 +1,56 @@
+import java.text.ParseException;
+import java.util.Date;
+
+/**
+ * Represents a task which could be something to do, an event or a deadline.
+ */
+
+public class Task {
+ protected String description;
+ protected boolean isDone;
+ protected Date date;
+
+ public Task(String description) {
+ this.description = description;
+ this.isDone = false;
+ }
+
+ public Task(String description, boolean isDone) {
+ this.description = description;
+ this.isDone = isDone;
+ }
+
+ public String getStatusIcon() {
+ return (isDone ? "\u2713" : "\u2718"); //return tick or X symbols
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void markAsDone() {
+ this.isDone = true;
+ }
+
+ public void setDescription(String newDescription) {
+ this.description = newDescription;
+ }
+
+ public void setDate(Date newDate) {
+ this.date = newDate;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + this.getStatusIcon() + "] " + this.description;
+ }
+
+ /**
+ * A method to write a task into a file according to the format that it can read.
+ * @return Returns the string format of a task to write into the designated file.
+ */
+
+ public String print() {
+ return "";
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/TaskList.class b/src/main/java/TaskList.class
new file mode 100644
index 0000000000..25a5f59c41
Binary files /dev/null and b/src/main/java/TaskList.class differ
diff --git a/src/main/java/TaskList.java b/src/main/java/TaskList.java
new file mode 100644
index 0000000000..78853cbcb7
--- /dev/null
+++ b/src/main/java/TaskList.java
@@ -0,0 +1,38 @@
+/**
+ * Class to represent the arraylist containing the tasks.
+ */
+
+import java.util.ArrayList;
+
+public class TaskList {
+ private ArrayList taskList;
+
+ public TaskList(ArrayList list) {
+ this.taskList = list;
+ }
+
+ public ArrayList getList() {
+ return this.taskList;
+ }
+
+ /**
+ * Method to find a task given a description in the task list.
+ * @param description keyword to find the task
+ * @return returns the task with given keyword
+ * @throws TaskNotFoundException no task with given keyword is found
+ */
+ public Task findTask(String description) throws TaskNotFoundException {
+ Task t = new Task("");
+ boolean flag = true;
+ for (Task task : taskList) {
+ if (task.getDescription().contains(description)) {
+ t = task;
+ flag = false;
+ }
+ }
+ if (flag) {
+ throw new TaskNotFoundException("Task not found.");
+ }
+ return t;
+ }
+}
diff --git a/src/main/java/TaskNotFoundException.java b/src/main/java/TaskNotFoundException.java
new file mode 100644
index 0000000000..b135ed961e
--- /dev/null
+++ b/src/main/java/TaskNotFoundException.java
@@ -0,0 +1,9 @@
+/**
+ * An exception that occurs when Duke is unable to decipher which command is given.
+ */
+
+public class TaskNotFoundException extends DukeException {
+ public TaskNotFoundException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/Todos.class b/src/main/java/Todos.class
new file mode 100644
index 0000000000..e256fc6ee9
Binary files /dev/null and b/src/main/java/Todos.class differ
diff --git a/src/main/java/Todos.java b/src/main/java/Todos.java
new file mode 100644
index 0000000000..45516685fe
--- /dev/null
+++ b/src/main/java/Todos.java
@@ -0,0 +1,28 @@
+/**
+ * Todos class to represent a task to do in the list.
+ */
+
+public class Todos extends Task {
+
+ public Todos(String description) {
+ super(description);
+ }
+
+ public Todos(String description, boolean isDone) {
+ super(description, isDone);
+ }
+
+ @Override
+ public String toString() {
+ return "[T]" + super.toString();
+ }
+
+ @Override
+ public String print() {
+ if (this.isDone) {
+ return "T @ 1 @ " + this.description;
+ } else {
+ return "T @ 0 @ " + this.description;
+ }
+ }
+}
diff --git a/src/main/java/Ui.class b/src/main/java/Ui.class
new file mode 100644
index 0000000000..831d905c55
Binary files /dev/null and b/src/main/java/Ui.class differ
diff --git a/src/main/java/Ui.java b/src/main/java/Ui.java
new file mode 100644
index 0000000000..4dc7e49212
--- /dev/null
+++ b/src/main/java/Ui.java
@@ -0,0 +1,21 @@
+/**
+ * A class to handle User Interactions.
+ */
+
+public class Ui {
+ /**
+ * Method to print task and number of tasks.
+ * @param count number of tasks in the list
+ * @param t type of task
+ * @return String representation of task and number of tasks.
+ */
+ public String printTask(int count, Task t) {
+ assert count > 0 : "Number of tasks cannot be negative.";
+ if (count == 1) {
+ return " " + t + "\nNow you have " + count + " task in the list.";
+ } else {
+ return " " + t + "\nNow you have " + count + " tasks in the list.";
+ }
+ }
+
+}
diff --git a/src/main/java/UnknownTaskException.class b/src/main/java/UnknownTaskException.class
new file mode 100644
index 0000000000..bb5aff4020
Binary files /dev/null and b/src/main/java/UnknownTaskException.class differ
diff --git a/src/main/java/UnknownTaskException.java b/src/main/java/UnknownTaskException.java
new file mode 100644
index 0000000000..c28ce64575
--- /dev/null
+++ b/src/main/java/UnknownTaskException.java
@@ -0,0 +1,9 @@
+/**
+ * An exception that occurs when Duke is unable to decipher which command is given.
+ */
+
+public class UnknownTaskException extends DukeException {
+ public UnknownTaskException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/UpdateCommand.java b/src/main/java/UpdateCommand.java
new file mode 100644
index 0000000000..ce1b5333e7
--- /dev/null
+++ b/src/main/java/UpdateCommand.java
@@ -0,0 +1,6 @@
+public abstract class UpdateCommand extends Command {
+
+
+ public abstract String execute(TaskList tasks, Ui ui, Storage storage);
+
+}
diff --git a/src/main/java/UpdateDateCommand.java b/src/main/java/UpdateDateCommand.java
new file mode 100644
index 0000000000..39dd9a5ed5
--- /dev/null
+++ b/src/main/java/UpdateDateCommand.java
@@ -0,0 +1,38 @@
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class UpdateDateCommand extends UpdateCommand {
+
+ private String taskDescription;
+ private String newDate;
+
+ public UpdateDateCommand(String taskDescription, String newDate) {
+ this.taskDescription = taskDescription;
+ this.newDate = newDate;
+ }
+
+ @Override
+ public String execute(TaskList tasks, Ui ui, Storage storage) {
+ Task task;
+ try {
+ task = tasks.findTask(taskDescription);
+ tasks.getList().remove(task);
+ Date date = new SimpleDateFormat("dd/MM/yyyy HHmm").parse(newDate);
+ task.setDate(date);
+ System.out.println(task);
+ } catch (TaskNotFoundException e) {
+ return e.getMessage();
+ } catch (ParseException e) {
+ return "Date in wrong format.";
+ }
+ tasks.getList().add(task);
+ storage.writeFile(tasks.getList());
+ return toString() + ui.printTask(tasks.getList().size(), task);
+ }
+
+ @Override
+ public String toString() {
+ return "Got it. I've updated this task's date:\n";
+ }
+}
diff --git a/src/main/java/UpdateDescriptionCommand.java b/src/main/java/UpdateDescriptionCommand.java
new file mode 100644
index 0000000000..50adedadc0
--- /dev/null
+++ b/src/main/java/UpdateDescriptionCommand.java
@@ -0,0 +1,30 @@
+public class UpdateDescriptionCommand extends UpdateCommand {
+
+ private String taskDescription;
+ private String newDescription;
+
+ public UpdateDescriptionCommand(String taskDescription, String newDescription) {
+ this.taskDescription = taskDescription;
+ this.newDescription = newDescription;
+ }
+
+ @Override
+ public String execute(TaskList tasks, Ui ui, Storage storage) {
+ Task task;
+ try {
+ task = tasks.findTask(taskDescription);
+ tasks.getList().remove(task);
+ task.setDescription(newDescription);
+ } catch (TaskNotFoundException e) {
+ return e.getMessage();
+ }
+ tasks.getList().add(task);
+ storage.writeFile(tasks.getList());
+ return toString() + ui.printTask(tasks.getList().size(), task);
+ }
+
+ @Override
+ public String toString() {
+ return "Got it. I've updated this task's description:\n";
+ }
+}
diff --git a/src/main/resources/images/DaDuke.png b/src/main/resources/images/DaDuke.png
new file mode 100644
index 0000000000..d893658717
Binary files /dev/null and b/src/main/resources/images/DaDuke.png differ
diff --git a/src/main/resources/images/DaUser.png b/src/main/resources/images/DaUser.png
new file mode 100644
index 0000000000..3c82f45461
Binary files /dev/null and b/src/main/resources/images/DaUser.png differ
diff --git a/src/main/resources/view/DialogBox.fxml b/src/main/resources/view/DialogBox.fxml
new file mode 100644
index 0000000000..e433809947
--- /dev/null
+++ b/src/main/resources/view/DialogBox.fxml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml
new file mode 100644
index 0000000000..435f3ce0d8
--- /dev/null
+++ b/src/main/resources/view/MainWindow.fxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/ParserTest.java b/src/test/java/ParserTest.java
new file mode 100644
index 0000000000..4efffe4d6e
--- /dev/null
+++ b/src/test/java/ParserTest.java
@@ -0,0 +1,14 @@
+/**
+ * Test class to test parse() method in Parser.
+ */
+
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class ParserTest {
+ @Test
+ public void parseTest() {
+ assertEquals(new DoneCommand(2), Parser.parse("done 3"));
+ }
+
+}
diff --git a/src/test/java/TodosTest.java b/src/test/java/TodosTest.java
new file mode 100644
index 0000000000..e123a548ad
--- /dev/null
+++ b/src/test/java/TodosTest.java
@@ -0,0 +1,23 @@
+/**
+ * Test class to test the print() and toString() method in Todos class.
+ */
+
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class TodosTest {
+ @Test
+ public void dummyTest() {
+ assertEquals(2, 2);
+ }
+
+ @Test
+ public void testPrint() {
+ assertEquals("T @ 1 @ borrow book", new Todos("borrow book", true).print());
+ }
+
+ @Test
+ public void testToString() {
+ assertEquals("[T][\u2713] play basketball", new Todos("play basketball", true).toString());
+ }
+}
\ No newline at end of file