diff --git a/README.md b/README.md
index 8715d4d915..63387cc8b6 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Duke project template
+# luke.Duke project template
This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.
@@ -13,7 +13,7 @@ Prerequisites: JDK 11, update Intellij to the most recent version.
1. If there are any further prompts, accept the defaults.
1. Configure the project to use **JDK 11** (not other versions) as explained in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).
In the same dialog, set the **Project language level** field to the `SDK default` option.
-3. After that, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
+3. After that, locate the `src/main/java/luke.Duke.java` file, right-click it, and choose `Run luke.Duke.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
```
Hello from
____ _
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000000..222d04af5d
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,62 @@
+plugins {
+ id 'java'
+ id 'application'
+ id 'com.github.johnrengelman.shadow' version '7.1.2'
+ id 'checkstyle'
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ String javaFxVersion = '17.0.7'
+
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
+
+ testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.0'
+ testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.0'
+}
+
+test {
+ useJUnitPlatform()
+
+ testLogging {
+ events "passed", "skipped", "failed"
+
+ showExceptions true
+ exceptionFormat "full"
+ showCauses true
+ showStackTraces true
+ showStandardStreams = false
+ }
+}
+
+application {
+ mainClass.set("luke.Luke")
+}
+
+shadowJar {
+ archiveBaseName = "luke"
+ archiveClassifier = null
+ dependsOn("distZip", "distTar")
+}
+
+checkstyle {
+ toolVersion = '10.2'
+}
+
+run{
+ standardInput = System.in
+}
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000000..eb761a9b9a
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,434 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml
new file mode 100644
index 0000000000..39efb6e4ac
--- /dev/null
+++ b/config/checkstyle/suppressions.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
diff --git a/docs/README.md b/docs/README.md
index 8077118ebe..ad067e2620 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,29 +1,140 @@
-# User Guide
+# Luke User Guide
+Luke is a simplistic Todo List application that helps you to keep track of your tasks and manage your time more efficiently. It is a desktop app that allows you to manage your tasks using a Command Line Interface (CLI) while still having the benefits of a Graphical User Interface (GUI).
-## Features
+![Ui.png](Ui.png)
-### Feature-ABC
+## Adding Tasks
-Description of the feature.
+To add a task, you can use the `todo` keyword followed by the task description and press the "Send" button.
-### Feature-XYZ
+Example: `todo Go for a run`
-Description of the feature.
+```
+Got it! I've added this task:
+ [T][ ] Go for a run
+Now you have 1 task in the list.
+```
+
+## Adding Deadlines
+
+To add a deadline task, you can use the `deadline` keyword followed by the task description and the deadline datetime with `/by`. Then, press the "Send" button.
+
+Date Format: `dd/mm/yyyy` or `dd-mm-yyyy` or `yyyy-mm-dd` or `yyyy/mm/dd`
+
+Time Format (optional, default is 00:00): `HH:mm` or `HH[:mm]`
+
+Example: `deadline Do Assignment /by 13/03/2024 23:59`
+
+```
+Got it! I've added this task:
+ [D][ ] Do Assignment (by: Mar 13 2024 11:59 PM)
+Now you have 2 tasks in the list.
+```
+
+## Adding Events
+
+To add an event task, you can use the `event` keyword followed by the event description, the start datetime with `/from`, and the end datetime with `/to`. Then, press the "Send" button.
+
+Date Format: `dd/mm/yyyy` or `dd-mm-yyyy` or `yyyy-mm-dd` or `yyyy/mm/dd`
+
+Time Format (optional, default is 00:00): `HH:mm` or `HH[:mm]`
+
+Example: `event Project meeting /from 13/03/2024 13:00 /to 13/03/2024 16:00`
+
+```
+Got it! I've added this task:
+ [E][ ] Project meeting (from: Mar 13 2024 13:00 to: Mar 13 2024 16:00)
+Now you have 3 task in the list.
+```
+
+## Marking Tasks as Done
+
+To mark a task as done, you can use the `mark` keyword followed by the index and press the "Send" button.
+
+Example: `mark 1`
+
+```
+Nice! I've marked this task as done:
+ [T][X] Go for a run
+```
-## Usage
+## Unmarking Tasks as Undone
-### `Keyword` - Describe action
+To unmark a task as undone, you can use the `unmark` keyword followed by the index and press the "Send" button.
-Describe the action and its outcome.
+Example: `unmark 1`
-Example of usage:
+```
+Nice! I've marked this task as not done yet:
+ [T][ ] Go for a run
+```
+
+## Finding Tasks
+
+To find tasks containing a specific keyword, you can use the `find` keyword followed by the keyword and press the "Send" button.
+
+Example: `find meeting`
+
+```
+Here are the matching tasks in your list:
+ 1.[E][ ] Project meeting (from: Mar 13 2024 13:00 to: Mar 13 2024 16:00)
+```
+
+## Viewing the Task List
+
+To view the list of tasks, you can use the `list` keyword and press the "Send" button.
+
+Example: `list`
+
+```
+Here are the tasks in your list:
+ 1.[T][ ] Go for a run
+ 2.[D][ ] Do Assignment (by: Mar 13 2024 11:59 PM)
+ 3.[E][ ] Project meeting (from: Mar 13 2024 13:00 to: Mar 13 2024 16:00)
+```
+
+## Deleting Tasks
+
+To delete a task, you can use the `delete` keyword followed by the index and press the "Send" button.
+
+Example: `delete 1`
+
+```
+Noted! I've removed this task:
+ [T][] Go for a run
+Now you have 2 tasks in the list.
+```
-`keyword (optional arguments)`
+## Help Page
-Expected outcome:
+To view the help page, just type `help` and press the "Send" button.
-Description of the outcome.
+Example: `help`
```
-expected output
+Here are the commands you can use:
+1. todo - Adds a todo task to the list.
+2. deadline /by - Adds a deadline task to the list.
+3. event /from /to - Adds an event task to the list.
+4. list - Lists all the tasks in the list.
+5. find - Finds all the tasks with the keyword in the list.
+6. delete - Deletes the task at the index from the list.
+7. mark - Marks the task at the index as done.
+8. unmark - Marks the task at the index as not done yet.
+9. bye - Exits the application.
+10. help - Shows the list of commands you can use.
+Examples of date and time formats:
+1. dd/MM/yyyy HH:mm
+2. yyyy-MM-dd HH:mm
+3. yyyy/MM/dd HH:mm
+4. dd-MM-yyyy HH:mm
+You can choose to enter the time or not, the default time is 00:00.
+If you wish to enter the time, please enter the time in 24-hour format such as HH[:mm] after the date.
```
+
+
+## Exiting Luke
+
+To exit Luke, just type `bye` and press the "Send" button.
+
+Example: `bye`
\ No newline at end of file
diff --git a/docs/Ui.png b/docs/Ui.png
new file mode 100644
index 0000000000..4d385b9f26
Binary files /dev/null and b/docs/Ui.png differ
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000..033e24c4cd
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..66c01cfeba
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000000..fcb6fca147
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,248 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original 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 POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# 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 ;; #(
+ MSYS* | 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
+ if ! command -v java >/dev/null 2>&1
+ then
+ 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
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# 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"'
+
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000000..6689b85bee
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,92 @@
+@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=.
+@rem This is normally unused
+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% equ 0 goto execute
+
+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 execute
+
+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
+
+: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 %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 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!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/src/main/data/luke.txt b/src/main/data/luke.txt
new file mode 100644
index 0000000000..c1d19e7524
--- /dev/null
+++ b/src/main/data/luke.txt
@@ -0,0 +1,6 @@
+E|O|project meeting|2024-03-11 13:00|2024-03-11 15:00
+T|O|go for a run
+D|O|assignment|2024-02-28 18:00
+T|O|mock test
+T|O|go for a run
+D|O|do assignment|2024-03-13 23:59
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/luke/DialogBox.java b/src/main/java/luke/DialogBox.java
new file mode 100644
index 0000000000..9f7a7a38dd
--- /dev/null
+++ b/src/main/java/luke/DialogBox.java
@@ -0,0 +1,49 @@
+package luke;
+
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.geometry.Pos;
+import javafx.scene.Node;
+import javafx.scene.control.Label;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.HBox;
+
+
+// Solution below adapted from https://se-education.org/guides/tutorials/javaFxPart3.html
+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 getLukeDialog(Label l, ImageView iv) {
+ var db = new DialogBox(l, iv);
+ db.flip();
+ return db;
+ }
+
+}
diff --git a/src/main/java/luke/Launcher.java b/src/main/java/luke/Launcher.java
new file mode 100644
index 0000000000..a01ba2a942
--- /dev/null
+++ b/src/main/java/luke/Launcher.java
@@ -0,0 +1,13 @@
+package luke;
+
+import javafx.application.Application;
+
+/**
+ * A launcher class to workaround classpath issues.
+ */
+public class Launcher {
+ public static void main(String[] args) {
+ Application.launch(Luke.class, args);
+ }
+
+}
diff --git a/src/main/java/luke/Luke.java b/src/main/java/luke/Luke.java
new file mode 100644
index 0000000000..190bd7541d
--- /dev/null
+++ b/src/main/java/luke/Luke.java
@@ -0,0 +1,205 @@
+package luke;
+
+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.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.Region;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+import luke.exception.FileException;
+import luke.exception.LukeException;
+import luke.parser.Parser;
+import luke.task.TaskList;
+import luke.ui.Ui;
+
+/**
+ * Represents the main class of the program.
+ */
+public class Luke extends Application {
+ private static final String FILE_PATH = "./src/main/data/luke.txt";
+ private ScrollPane scrollPane;
+ private VBox dialogContainer;
+ private TextField userInput;
+ private Button sendButton;
+ private Scene scene;
+ private Storage storage;
+ private Ui ui;
+ private TaskList tasks;
+ private Image user = new Image(this.getClass().getResourceAsStream("/images/user.jpeg"));
+ private Image luke = new Image(this.getClass().getResourceAsStream("/images/luke.jpeg"));
+
+ /**
+ * Constructor for Luke that initializes the Ui, Storage and TaskList.
+ *
+ * @param filePath The file path of the file to be read from.
+ */
+ public Luke(String filePath) {
+ ui = new Ui();
+ storage = new Storage(filePath);
+ try {
+ tasks = new TaskList(storage.readTask());
+
+ } catch (FileException e) {
+ ui.getErrorMessage(e.getMessage());
+ tasks = new TaskList();
+ }
+
+ }
+
+ /**
+ * Constructor for Luke that initializes the Ui, Storage and TaskList for the GUI
+ */
+ public Luke() {
+ ui = new Ui();
+ storage = new Storage(FILE_PATH);
+ try {
+ tasks = new TaskList(storage.readTask());
+
+ } catch (FileException e) {
+ ui.getErrorMessage(e.getMessage());
+ tasks = new TaskList();
+ }
+
+ }
+
+ /**
+ * Runs the program.
+ */
+ public void run() {
+ // Greetings
+ System.out.println(ui.welcome());
+
+ boolean isExit = false;
+ Parser parser = new Parser("");
+ String response = "";
+
+ // Conditions
+ while (!isExit) {
+ String inputString = ui.readCommand();
+ parser.setInput(inputString);
+ response = parser.parse(tasks, ui, storage);
+ isExit = parser.isExit();
+
+ }
+
+ assert response != null : "Response should not be null";
+ // Bye and exits
+ System.out.println(response);
+ }
+
+ /**
+ * Runs the program in the main method.
+ *
+ * @param args The arguments passed in.
+ * @throws LukeException If an error occurs.
+ */
+ public static void main(String[] args) throws LukeException {
+ new Luke(FILE_PATH).run();
+
+ }
+
+ @Override
+ public void start(Stage stage) {
+ AnchorPane mainLayout = formatStage(stage);
+ formatDialogBox(stage, mainLayout);
+
+ //Step 3. Add functionality to handle user input.
+ sendButton.setOnMouseClicked((event) -> {
+ handleUserInput();
+ });
+
+ userInput.setOnAction((event) -> {
+ handleUserInput();
+ });
+
+ //Scroll down to the end every time dialogContainer's height changes.
+ dialogContainer.heightProperty().addListener((observable) -> scrollPane.setVvalue(1.0));
+
+
+ }
+
+ private AnchorPane formatStage(Stage stage) {
+ //Step 1. Setting up required components
+ // Referred to https://se-education.org/guides/tutorials/javaFxPart2.html and used the code
+ 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();
+
+ return mainLayout;
+
+ }
+
+
+ private void formatDialogBox(Stage stage, AnchorPane mainLayout) {
+ //Step 2. Formatting the window to look as expected
+ stage.setTitle("Luke");
+ 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);
+ 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);
+
+ Label lukeText = new Label(ui.welcome());
+ dialogContainer.getChildren().addAll(
+ DialogBox.getLukeDialog(lukeText, new ImageView(luke))
+ );
+ }
+
+ private void handleUserInput() {
+ Label userText = new Label(userInput.getText());
+ Label lukeText = new Label(getResponse());
+
+ dialogContainer.getChildren().addAll(
+ DialogBox.getUserDialog(userText, new ImageView(user)),
+ DialogBox.getLukeDialog(lukeText, new ImageView(luke))
+ );
+
+ if (userInput.getText().equals("bye")) {
+ System.exit(0);
+ }
+ userInput.clear();
+ }
+
+ private String getResponse() {
+ String input = userInput.getText();
+ Parser parser = new Parser(input);
+ return parser.parse(tasks, ui, storage);
+
+ }
+
+}
diff --git a/src/main/java/luke/Storage.java b/src/main/java/luke/Storage.java
new file mode 100644
index 0000000000..65bff52e1e
--- /dev/null
+++ b/src/main/java/luke/Storage.java
@@ -0,0 +1,124 @@
+package luke;
+
+import luke.exception.DateException;
+import luke.exception.FileException;
+import luke.task.Deadline;
+import luke.task.Event;
+import luke.task.Task;
+import luke.task.TaskList;
+import luke.task.Todo;
+import luke.ui.Ui;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Scanner;
+
+/**
+ * Represents the storage of the tasks into a file and reading the tasks from the file.
+ */
+public class Storage {
+ private File file;
+ private Ui ui;
+
+ /**
+ * Constructor for Storage that initializes the file and Ui, and creates the file if it does not exist.
+ *
+ * @param path The file path of the file to be read from.
+ */
+ public Storage(String path) {
+ this.file = new File(path);
+
+ if (!this.file.exists()) {
+ try {
+ this.file.getParentFile().mkdirs();
+ this.file.createNewFile();
+ } catch (IOException e) {
+ System.out.println("Sorry! There was an error creating the file! :'(");
+ e.printStackTrace();
+ }
+ }
+ this.ui = new Ui();
+
+ }
+
+ /**
+ * Reads the tasks from the file and returns an ArrayList of tasks.
+ *
+ * @return An ArrayList of tasks read from the file.
+ * @throws FileException If the file is not found or is corrupted.
+ */
+ public ArrayList readTask() throws FileException {
+ ArrayList tasks = new ArrayList();
+ // Read tasks from file
+ try (Scanner sc = new Scanner(this.file)) {
+ while (sc.hasNextLine()) {
+ String line = sc.nextLine();
+ assert line != null : "Line should not be null";
+ String[] parts = line.split("\\|");
+
+ assert parts.length == 3 || parts.length == 4 || parts.length == 5 : "Line should have 3, 4 or 5 parts";
+ String type = parts[0];
+ String markOrUnmark = parts[1];
+ String description = parts[2];
+
+ if (type.equals("T")) {
+ Task task = new Todo(description);
+ tasks.add(handleMarkOrUnmark(task, markOrUnmark));
+
+ } else if (type.equals("D")) {
+ String by = parts[3];
+ Task task = new Deadline(description, by);
+ tasks.add(handleMarkOrUnmark(task, markOrUnmark));
+
+ } else if (type.equals("E")) {
+ String from = parts[3];
+ String to = parts[4];
+ Task task = new Event(description, from, to);
+ tasks.add(handleMarkOrUnmark(task, markOrUnmark));
+
+ }
+ }
+ } catch (FileNotFoundException e) {
+ throw new FileException("Sorry! File not found! :'(");
+
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new FileException("Sorry! File is corrupted! :'(\nWill not be able to read tasks from file! :'(");
+
+ } catch (DateException e) {
+ ui.getErrorMessage(e.getMessage() + "\nPlease enter the date in proper format such as dd/MM/yyyy or "
+ + "yyyy-MM-dd\nYou can also enter the time in 24-hour format such as HH[:mm] after the date");
+
+ }
+ System.out.println(tasks);
+ return tasks;
+ }
+
+ private Task handleMarkOrUnmark(Task task, String markOrUnmark) {
+ if (markOrUnmark.equals("X")) {
+ task.markAsDone();
+ }
+ return task;
+ }
+
+ /**
+ * Writes the list of tasks to the data file.
+ *
+ * @param tasks The TaskList of tasks to be written to the file.
+ * @throws FileException If there is an error editing the file.
+ */
+ public void writeTask(TaskList tasks) throws FileException {
+ try (FileWriter fw = new FileWriter(this.file, false)) {
+ for (int i = 0; i < tasks.size(); i++) {
+ fw.write(tasks.get(i).toDataString() + "\n");
+ }
+
+ } catch (IOException e) {
+ throw new FileException("Sorry! There was an error editing the file! :'(");
+ }
+
+
+ }
+}
diff --git a/src/main/java/luke/exception/DateException.java b/src/main/java/luke/exception/DateException.java
new file mode 100644
index 0000000000..af9d77b143
--- /dev/null
+++ b/src/main/java/luke/exception/DateException.java
@@ -0,0 +1,10 @@
+package luke.exception;
+
+/**
+ * Represents an exception when the date is not in the correct format.
+ */
+public class DateException extends Exception {
+ public DateException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/luke/exception/FileException.java b/src/main/java/luke/exception/FileException.java
new file mode 100644
index 0000000000..a43c642333
--- /dev/null
+++ b/src/main/java/luke/exception/FileException.java
@@ -0,0 +1,10 @@
+package luke.exception;
+
+/**
+ * Represents an exception when the file cannot be read or written to.
+ */
+public class FileException extends Exception {
+ public FileException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/luke/exception/LukeException.java b/src/main/java/luke/exception/LukeException.java
new file mode 100644
index 0000000000..47e70ab935
--- /dev/null
+++ b/src/main/java/luke/exception/LukeException.java
@@ -0,0 +1,10 @@
+package luke.exception;
+
+/**
+ * Represents an exception when the program encounters an error.
+ */
+public class LukeException extends Exception {
+ public LukeException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/luke/exception/TaskException.java b/src/main/java/luke/exception/TaskException.java
new file mode 100644
index 0000000000..5d5b09dce2
--- /dev/null
+++ b/src/main/java/luke/exception/TaskException.java
@@ -0,0 +1,10 @@
+package luke.exception;
+
+/**
+ * Represents an exception when the task is not in the correct format.
+ */
+public class TaskException extends Exception {
+ public TaskException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/luke/parser/DateTimeParser.java b/src/main/java/luke/parser/DateTimeParser.java
new file mode 100644
index 0000000000..8d009b6231
--- /dev/null
+++ b/src/main/java/luke/parser/DateTimeParser.java
@@ -0,0 +1,49 @@
+package luke.parser;
+
+import luke.exception.DateException;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.DateTimeParseException;
+import java.time.temporal.ChronoField;
+
+/**
+ * Represents a parser that parses a string into a LocalDateTime object and throws an
+ * exception if the date is not in the correct format.
+ */
+public class DateTimeParser {
+ private LocalDateTime date;
+
+ /**
+ * Constructs a DateTimeParser object and parses the date into a LocalDateTime object.
+ *
+ * @param date The date to be parsed into a LocalDateTime object from a string.
+ * @throws DateException If the date is not in the correct format.
+ */
+ public DateTimeParser(String date) throws DateException {
+ DateTimeFormatter formatter = new DateTimeFormatterBuilder()
+ .appendPattern("[dd/MM/yyyy]" + "[yyyy/MM/dd]" + "[yyyy-MM-dd]" + "[dd-MM-yyyy]")
+ .optionalStart()
+ .appendPattern("[ HH:mm]" + "[ HH]")
+ .parseDefaulting(ChronoField.HOUR_OF_DAY, 0)
+ .parseDefaulting(ChronoField.MINUTE_OF_HOUR, 0)
+ .optionalEnd()
+ .toFormatter();
+
+ try {
+ this.date = LocalDateTime.parse(date, formatter);
+ } catch (DateTimeParseException e) {
+ this.date = null;
+ }
+
+ if (this.date == null) {
+ throw new DateException("Sorry! The date is not in the correct format! :'(");
+ }
+ }
+
+ public LocalDateTime getDateTime() {
+ return this.date;
+ }
+
+}
diff --git a/src/main/java/luke/parser/Parser.java b/src/main/java/luke/parser/Parser.java
new file mode 100644
index 0000000000..86432b1db4
--- /dev/null
+++ b/src/main/java/luke/parser/Parser.java
@@ -0,0 +1,241 @@
+package luke.parser;
+
+import luke.Storage;
+import luke.exception.DateException;
+import luke.exception.FileException;
+import luke.exception.LukeException;
+import luke.exception.TaskException;
+import luke.task.Deadline;
+import luke.task.Event;
+import luke.task.Task;
+import luke.task.TaskList;
+import luke.task.Todo;
+import luke.ui.Ui;
+
+
+/**
+ * Represents a parser that parses the user input and executes the corresponding command.
+ */
+public class Parser {
+ private String input;
+
+ /**
+ * Constructor for the parser.
+ *
+ * @param input The user input.
+ */
+ public Parser(String input) {
+ this.input = input;
+
+ }
+
+ /**
+ * Parses the user input and executes the corresponding command to add, delete, mark, unmark or list the tasks
+ * as well as to exit the program.
+ *
+ * @param list The list of tasks.
+ * @param ui The user interface.
+ * @param storage The storage of the tasks.
+ */
+ public String parse(TaskList list, Ui ui, Storage storage) {
+ if (isExit()) {
+ return ui.goodbye();
+ } else if (this.input.equals("help")) {
+ return ui.help();
+ } else if (this.input.equals("list")) {
+ return ui.printList(list);
+ } else if (this.input.startsWith("find")) {
+ try {
+ if (input.equals("find") || input.equals("find ")) {
+ throw new LukeException("Hold up!! There must be a keyword to find!\n"
+ + "Please enter a keyword after find.");
+ }
+ return findCommand(list, ui);
+ } catch (LukeException e) {
+ return ui.getErrorMessage(e.getMessage());
+ }
+ } else if (this.input.contains("mark")) {
+ try {
+ if (input.equals("mark") || input.equals("unmark")
+ || input.equals("mark ") || input.equals("unmark ")) {
+ throw new LukeException("Hold up!! There must be a task to " + input + "!\n"
+ + "Please enter an index after " + input + ".");
+ }
+ return markCommand(list, storage, ui);
+
+ } catch (LukeException e) {
+ return ui.getErrorMessage(e.getMessage());
+ }
+ } else if (input.startsWith("delete")) {
+ try {
+ if (input.equals("delete") || input.equals("delete ")) {
+ throw new LukeException("Hold up!! There must be a task to delete!\n"
+ + "Please enter an index after " + input + ".");
+ }
+ return deleteCommand(list, storage, ui);
+
+ } catch (LukeException e) {
+ return ui.getErrorMessage(e.getMessage());
+ }
+ } else {
+ try {
+ if (input.equals("todo") || input.equals("deadline") || input.equals("event")
+ || input.equals("todo ") || input.equals("deadline ") || input.equals("event ")) {
+ throw new LukeException("Hold up!! The description of a " + input + " cannot be empty.\n"
+ + "Please enter a description after your " + input + ".");
+ }
+ String[] instruction = input.split(" ");
+ String type = instruction[0];
+
+ if (type.equals("todo")) {
+ list.add(todoCommand());
+
+ } else if (type.equals("deadline")) {
+ try {
+ list.add(deadlineCommand());
+
+ } catch (StringIndexOutOfBoundsException e) {
+ throw new TaskException("Hold up!! The description and /by of a deadline cannot be empty.\n"
+ + "Please follow this format: deadline /by .");
+ }
+
+ } else if (type.equals("event")) {
+ try {
+ list.add(eventCommand());
+ } catch (StringIndexOutOfBoundsException e) {
+ throw new TaskException("Hold up!! The description, /from and /to of an event "
+ + "cannot be empty.\n"
+ + "Please follow this format: event "
+ + "/from /to .");
+ }
+ } else {
+ throw new LukeException("Hold up!! I am sorry, but I don't know what you mean by that :'(");
+
+ }
+ storage.writeTask(list);
+ return ui.printTaskAdded(list.get(list.size() - 1), list.size());
+
+ } catch (LukeException | TaskException | FileException e) {
+ return ui.getErrorMessage(e.getMessage());
+ } catch (DateException e) {
+ return ui.getErrorMessage(e.getMessage() + "\nPlease enter the date in proper format such as "
+ + "dd/MM/yyyy or yyyy-MM-dd\nYou can also enter the time in 24-hour format such as "
+ + "HH[:MM] after the date");
+ }
+ }
+ }
+
+ private String findCommand(TaskList list, Ui ui) {
+ // 5 is the index after "find ", so starts from index 5
+ String keyword = input.substring(5);
+ TaskList foundList = list.find(keyword);
+ return ui.printTaskFound(foundList);
+ }
+
+ private String markCommand(TaskList list, Storage storage, Ui ui) throws LukeException {
+ try {
+ String returnString = "";
+ String[] instruction = input.split(" ");
+ String markOrUnmark = instruction[0];
+
+ if (!markOrUnmark.equals("mark") && !markOrUnmark.equals("unmark")) {
+ throw new LukeException("Hold up!! I am sorry, but I don't know what you mean by that :'(");
+ }
+
+ int index = Integer.parseInt(instruction[1]) - 1; // array is 0-indexed
+
+ if (index >= list.size()) {
+ throw new LukeException("Hold up!! There is no such task in the list.\n"
+ + "Please enter a valid index after " + input.split(" ")[0] + ".");
+ }
+
+ if (markOrUnmark.equals("mark")) {
+ list.get(index).markAsDone();
+ returnString = ui.printTaskMarked(list.get(index));
+
+ } else {
+ list.get(index).markAsUndone();
+ returnString = ui.printTaskMarked(list.get(index));
+
+ }
+
+ storage.writeTask(list);
+ return returnString;
+ } catch (NumberFormatException | IndexOutOfBoundsException e) {
+ throw new LukeException("Hold up!! Please enter a valid index after "
+ + input.split(" ")[0] + ".");
+ } catch (FileException e) {
+ return ui.getErrorMessage(e.getMessage());
+ }
+ }
+
+ private String deleteCommand(TaskList list, Storage storage, Ui ui) throws LukeException {
+ try {
+ String returnString = "";
+ String[] instruction = input.split(" ");
+ String delete = instruction[0];
+
+ if (!delete.equals("delete")) {
+ throw new LukeException("Hold up!! I am sorry, but I don't know what you mean by that :'(");
+ }
+
+ int index = Integer.parseInt(instruction[1]) - 1; // array is 0-indexed
+
+ if (index >= list.size()) {
+ throw new LukeException("Hold up!! There is no such task in the list.\n"
+ + "Please enter a valid index after delete.");
+ }
+
+ Task removedTask = list.get(index);
+ list.remove(index);
+ returnString = ui.printTaskDeleted(removedTask, list.size());
+ storage.writeTask(list);
+ return returnString;
+
+ } catch (NumberFormatException | IndexOutOfBoundsException e) {
+ throw new LukeException("Hold up!! Please enter a valid index after delete.");
+ } catch (FileException e) {
+ return ui.getErrorMessage(e.getMessage());
+ }
+ }
+
+ private Todo todoCommand() {
+ // 5 is the index after "todo ", so starts from index 5
+ String description = input.substring(5);
+ return new Todo(description);
+ }
+
+ private Deadline deadlineCommand() throws DateException {
+ // 9 is the index after "deadline ", so starts from index 9
+ // -1 to remove the space before "/by"
+ String description = input.substring(9, input.indexOf("/by") - 1);
+ // +4 to remove the "/by " and start from the index after "/by "
+ String by = input.substring(input.indexOf("/by") + 4);
+ return new Deadline(description, by);
+ }
+
+ private Event eventCommand() throws DateException {
+ // 6 is the index after "event ", so starts from index 6
+ // -1 to remove the space before "/from"
+ String description = input.substring(6, input.indexOf("/from") - 1);
+ // +6 to remove the "/from " and start from the index after "/from "
+ // -1 to remove the space before "/to"
+ String from = input.substring(input.indexOf("/from") + 6, input.indexOf("/to") - 1);
+ // +4 to remove the "/to " and start from the index after "/to "
+ String to = input.substring(input.indexOf("/to") + 4);
+ return new Event(description, from, to);
+ }
+
+ public void setInput(String input) {
+ this.input = input;
+ }
+
+ /**
+ * Checks if the user input is "bye".
+ *
+ * @return True if the user input is "bye", false otherwise.
+ */
+ public boolean isExit() {
+ return input.equals("bye");
+ }
+}
diff --git a/src/main/java/luke/task/Deadline.java b/src/main/java/luke/task/Deadline.java
new file mode 100644
index 0000000000..4f21fa35e4
--- /dev/null
+++ b/src/main/java/luke/task/Deadline.java
@@ -0,0 +1,55 @@
+package luke.task;
+
+import luke.exception.DateException;
+import luke.parser.DateTimeParser;
+
+import java.time.format.DateTimeFormatter;
+import java.time.LocalDateTime;
+
+
+/**
+ * Represents a deadline task, that has a description and a date and time of the deadline.
+ */
+public class Deadline extends Task {
+ protected LocalDateTime by;
+
+ /**
+ * Constructor for Deadline, which takes in the description and date of the deadline.
+ *
+ * @param description Description of the deadline task.
+ * @param by Date and time of the deadline.
+ * @throws DateException If the date is not in the correct format.
+ */
+ public Deadline(String description, String by) throws DateException {
+ super(description);
+ DateTimeParser dateTimeParser = new DateTimeParser(by);
+
+ this.by = dateTimeParser.getDateTime();
+
+ }
+
+ /**
+ * Returns the string representation of the deadline task to be saved in the data file.
+ *
+ * @return The string representation of the deadline task to be saved in the data file.
+ */
+ @Override
+ public String toDataString() {
+ return "D|" + super.toDataString() + "|" + this.by.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
+ }
+
+ /**
+ * Returns the string representation of the deadline task to be displayed to the user.
+ *
+ * @return The string representation of the deadline task to be displayed to the user.
+ */
+ private String formatDateTime(LocalDateTime date) {
+ return date.format(DateTimeFormatter.ofPattern("MMM d yyyy hh:mm a"));
+ }
+
+ @Override
+ public String toString() {
+ return "[D]" + super.toString() + " (by: " + formatDateTime(this.by) + ")";
+ }
+
+}
diff --git a/src/main/java/luke/task/Event.java b/src/main/java/luke/task/Event.java
new file mode 100644
index 0000000000..3a9689a3a6
--- /dev/null
+++ b/src/main/java/luke/task/Event.java
@@ -0,0 +1,59 @@
+package luke.task;
+
+import luke.exception.DateException;
+import luke.parser.DateTimeParser;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * Represents an event task, that is a task with a description and the starting and ending date and time.
+ */
+public class Event extends Task {
+ protected LocalDateTime from;
+ protected LocalDateTime to;
+
+ /**
+ * Constructor for Event, which takes in the description and the from and to dates of the event.
+ *
+ * @param description Description of the event.
+ * @param from Starting date and time of the event.
+ * @param to Ending date and time of the event.
+ * @throws DateException If the date is not in the correct format.
+ */
+ public Event(String description, String from, String to) throws DateException {
+ super(description);
+ DateTimeParser dateTimeParserFrom = new DateTimeParser(from);
+ DateTimeParser dateTimeParserTo = new DateTimeParser(to);
+
+ this.from = dateTimeParserFrom.getDateTime();
+ this.to = dateTimeParserTo.getDateTime();
+ }
+
+ /**
+ * Returns the string representation of the event task to be saved in the data file.
+ *
+ * @return The string representation of the event task to be saved in the data file.
+ */
+ @Override
+ public String toDataString() {
+ return "E|" + super.toDataString() + "|" + this.from.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))
+ + "|" + this.to.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
+ }
+
+ /**
+ * Returns the string representation of the event task to be displayed to the user.
+ *
+ * @return The string representation of the event task to be displayed to the user.
+ */
+ private String formatDateTime(LocalDateTime date) {
+ return date.format(DateTimeFormatter.ofPattern("MMM d yyyy hh:mm a"));
+ }
+
+ @Override
+ public String toString() {
+ return "[E]" + super.toString() + " (from: " + formatDateTime(this.from)
+ + " to: " + formatDateTime(this.to) + ")";
+
+ }
+}
diff --git a/src/main/java/luke/task/Task.java b/src/main/java/luke/task/Task.java
new file mode 100644
index 0000000000..59301b1717
--- /dev/null
+++ b/src/main/java/luke/task/Task.java
@@ -0,0 +1,66 @@
+package luke.task;
+
+/**
+ * Represents a task in the task list.
+ */
+public class Task {
+ protected String description;
+ protected boolean isDone;
+
+ /**
+ * Constructor for Task, which takes in a description of the task and sets the task as not done.
+ *
+ * @param description Description of the task.
+ */
+ public Task(String description) {
+ this.description = description;
+ this.isDone = false;
+ }
+
+ /**
+ * Returns the status of the task with either an X if the task is done or a space if the task is not done.
+ *
+ * @return The status of the task in String format.
+ */
+ private String printStatus() {
+ return (this.isDone ? "X" : " "); // mark done task with X
+ }
+
+ public boolean getIsDone() {
+ return this.isDone;
+ }
+
+ public void markAsDone() {
+ this.isDone = true;
+
+ }
+
+ public void markAsUndone() {
+ this.isDone = false;
+ }
+
+ /**
+ * Returns true if the task description contains the keyword, and false otherwise.
+ *
+ * @param keyword The keyword to be checked against the task description.
+ * @return True if the task description contains the keyword, and false otherwise.
+ */
+ public boolean matchKeyword(String keyword) {
+ return this.description.contains(keyword);
+ }
+
+ /**
+ * Returns the string representation of the task to be saved in the data file.
+ *
+ * @return The string representation of the task to be saved in the data file.
+ */
+ public String toDataString() {
+ return (this.isDone ? "X" : "O") + "|" + this.description;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + printStatus() + "] " + this.description;
+ }
+
+}
diff --git a/src/main/java/luke/task/TaskList.java b/src/main/java/luke/task/TaskList.java
new file mode 100644
index 0000000000..9de449cc00
--- /dev/null
+++ b/src/main/java/luke/task/TaskList.java
@@ -0,0 +1,108 @@
+package luke.task;
+
+import java.util.ArrayList;
+
+/**
+ * Represents a list of tasks, where each task is stored in an ArrayList.
+ */
+public class TaskList {
+ private ArrayList list;
+
+ /**
+ * Constructs a TaskList object with an empty ArrayList.
+ */
+ public TaskList() {
+ list = new ArrayList<>();
+
+ }
+
+ /**
+ * Constructs a TaskList object with an ArrayList of tasks provided.
+ *
+ * @param list ArrayList of tasks.
+ */
+ public TaskList(ArrayList list) {
+ this.list = list;
+ }
+
+ /**
+ * Adds a task to the list of tasks.
+ *
+ * @param task The task to be added to the list of tasks.
+ */
+ public void add(Task task) {
+ list.add(task);
+ }
+
+ /**
+ * Removes a task from the list of tasks.
+ *
+ * @param index The index of the task to be removed from the list of tasks.
+ */
+ public void remove(int index) {
+ list.remove(index);
+ }
+
+ /**
+ * Returns the number of tasks in the list.
+ *
+ * @return The number of tasks in the list.
+ */
+ public int size() {
+ return list.size();
+ }
+
+ /**
+ * Returns the task at the specified index in the list.
+ *
+ * @param index The index of the task in the list.
+ * @return The task at the specified index in the list.
+ */
+ public Task get(int index) {
+ return list.get(index);
+ }
+
+ /**
+ * Returns the whole list of tasks.
+ *
+ * @return The whole list of tasks.
+ */
+ public ArrayList getList() {
+ return list;
+ }
+
+ /**
+ * Marks a task as done in the list of tasks using the index of the task.
+ *
+ * @param index The index of the task to be marked as done.
+ */
+ public void markTask(int index) {
+ list.get(index).markAsDone();
+ }
+
+ /**
+ * Marks a task as undone in the list of tasks using the index of the task.
+ *
+ * @param index The index of the task to be marked as undone.
+ */
+ public void unmarkTask(int index) {
+ list.get(index).markAsUndone();
+ }
+
+ /**
+ * Finds tasks in the list of tasks that contain the keyword.
+ *
+ * @param keyword The keyword to be found in the list of tasks.
+ * @return The list of tasks that contains the keyword.
+ */
+ public TaskList find(String keyword) {
+ TaskList foundList = new TaskList();
+ for (Task task : list) {
+ if (task.matchKeyword(keyword)) {
+ foundList.add(task);
+ }
+ }
+ return foundList;
+ }
+
+}
diff --git a/src/main/java/luke/task/Todo.java b/src/main/java/luke/task/Todo.java
new file mode 100644
index 0000000000..14496f9bd6
--- /dev/null
+++ b/src/main/java/luke/task/Todo.java
@@ -0,0 +1,30 @@
+package luke.task;
+
+/**
+ * Represents a task with a description only.
+ */
+public class Todo extends Task {
+ /**
+ * Constructor for Todo, which is a task with a description only.
+ *
+ * @param description Description of the task.
+ */
+ public Todo(String description) {
+ super(description);
+ }
+
+ /**
+ * Returns the string representation of the task in the format to be saved in the data file.
+ *
+ * @return String representation of the task in the format to be saved in the data file.
+ */
+ @Override
+ public String toDataString() {
+ return "T|" + super.toDataString();
+ }
+
+ @Override
+ public String toString() {
+ return "[T]" + super.toString();
+ }
+}
diff --git a/src/main/java/luke/ui/Ui.java b/src/main/java/luke/ui/Ui.java
new file mode 100644
index 0000000000..146c7e2037
--- /dev/null
+++ b/src/main/java/luke/ui/Ui.java
@@ -0,0 +1,179 @@
+package luke.ui;
+
+import java.util.Scanner;
+
+import luke.task.Task;
+import luke.task.TaskList;
+
+/**
+ * Represents the user interface of the application.
+ */
+public class Ui {
+ private Scanner sc;
+
+ /**
+ * Constructs an Ui object, where the scanner is initialised.
+ */
+ public Ui() {
+ sc = new Scanner(System.in);
+
+ }
+
+ /**
+ * Prints the welcome message when the application starts.
+ */
+ public String welcome() {
+
+ return "\nHello! I'm Luke!\nWhat can I do for you?\n";
+ }
+
+ /**
+ * Prints the goodbye message when the application exits.
+ */
+ public String goodbye() {
+ return "\nBye! Hope to see you again soon!\n";
+
+ }
+
+ /**
+ * Prints the error message when an error occurs.
+ *
+ * @param message The error message to be printed.
+ */
+ public String getErrorMessage(String message) {
+ return "\n" + message + "\n";
+
+ }
+
+ /**
+ * Prints the list of tasks in the TaskList.
+ *
+ * @param tasks The TaskList to be printed.
+ */
+ public String printList(TaskList tasks) {
+ StringBuilder listString = new StringBuilder();
+ listString = new StringBuilder("\nHere are the tasks in your list:\n");
+
+ for (int i = 0; i < tasks.size(); i++) {
+ if (tasks.get(i) != null) {
+ String taskString = i + 1 + "." + tasks.get(i);
+ listString.append(taskString).append("\n");
+
+ }
+ }
+ return listString.toString();
+ }
+
+ /**
+ * Prints the task when the task just got marked or unmarked.
+ *
+ * @param task The task that is marked or unmarked.
+ */
+ public String printTaskMarked(Task task) {
+ String status = "";
+ if (task.getIsDone()) {
+ status = "done:";
+ } else {
+ status = "not done yet:";
+ }
+
+ return "\nNice! I've marked this task as " + status + "\n" + task + "\n";
+
+ }
+
+ /**
+ * Prints the task when added to the TaskList.
+ *
+ * @param task The task that is added.
+ * @param size The size of the TaskList.
+ */
+ public String printTaskAdded(Task task, int size) {
+ String taskStringType = "";
+ if (size > 1) {
+ taskStringType = "tasks";
+ } else {
+ taskStringType = "task";
+ }
+
+ return "\nGot it! I've added this task:\n" + task + "\nNow you have " + size + " "
+ + taskStringType + " in the list.\n";
+
+ }
+
+ /**
+ * Prints the task when deleted from the TaskList.
+ *
+ * @param task The task that is deleted.
+ * @param size The size of the TaskList.
+ */
+ public String printTaskDeleted(Task task, int size) {
+ String taskStringType = "";
+ if (size > 1) {
+ taskStringType = "tasks";
+ } else {
+ taskStringType = "task";
+ }
+
+ return "\nNoted! I've removed this task:\n" + task + "\nNow you have " + size + " "
+ + taskStringType + " in the list.\n";
+
+ }
+
+ /**
+ * Reads the command from the user.
+ *
+ * @return The command from the user in String format after trimming.
+ */
+ public String readCommand() {
+ return sc.nextLine().trim();
+
+ }
+
+ /**
+ * Prints the tasks found in the TaskList.
+ *
+ * @param tasks The TaskList of tasks found.
+ * @return The tasks found in the TaskList as a String.
+ */
+ public String printTaskFound(TaskList tasks) {
+ StringBuilder foundString = new StringBuilder();
+ foundString = new StringBuilder("\nHere are the matching tasks in your list:\n");
+
+ for (int i = 0; i < tasks.size(); i++) {
+ if (tasks.get(i) != null) {
+ String taskString = i + 1 + "." + tasks.get(i);
+ foundString.append(taskString).append("\n");
+ }
+ }
+ return foundString.toString();
+
+ }
+
+ /**
+ * Prints the help message when the user types "help".
+ *
+ * @return The help message as a String.
+ */
+ public String help() {
+ return "\nHere are the commands you can use:\n"
+ + "1. todo - Adds a todo task to the list.\n"
+ + "2. deadline /by - Adds a deadline task to the list.\n"
+ + "3. event /from /to - Adds an event task to the list.\n"
+ + "4. list - Lists all the tasks in the list.\n"
+ + "5. find - Finds all the tasks with the keyword in the list.\n"
+ + "6. delete - Deletes the task at the index from the list.\n"
+ + "7. mark - Marks the task at the index as done.\n"
+ + "8. unmark - Marks the task at the index as not done yet.\n"
+ + "9. bye - Exits the application.\n"
+ + "10. help - Shows the list of commands you can use.\n"
+ + "\nExamples of date and time formats:\n"
+ + "1. dd/MM/yyyy HH:mm\n"
+ + "2. yyyy-MM-dd HH:mm\n"
+ + "3. yyyy/MM/dd HH:mm\n"
+ + "4. dd-MM-yyyy HH:mm\n"
+ + "You can choose to enter the time or not, the default time is 00:00.\n"
+ + "If you wish to enter the time, "
+ + "please enter the time in 24-hour format such as HH[:mm] after the date.\n";
+
+ }
+}
diff --git a/src/main/resources/images/luke.jpeg b/src/main/resources/images/luke.jpeg
new file mode 100644
index 0000000000..ef592b5b24
Binary files /dev/null and b/src/main/resources/images/luke.jpeg differ
diff --git a/src/main/resources/images/user.jpeg b/src/main/resources/images/user.jpeg
new file mode 100644
index 0000000000..b0364461ef
Binary files /dev/null and b/src/main/resources/images/user.jpeg differ
diff --git a/src/main/resources/view/DialogBox.fxml b/src/main/resources/view/DialogBox.fxml
new file mode 100644
index 0000000000..59d16ac91a
--- /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..745c2095b6
--- /dev/null
+++ b/src/main/resources/view/MainWindow.fxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/java/luke/parser/DateTimeParserTest.java b/src/test/java/luke/parser/DateTimeParserTest.java
new file mode 100644
index 0000000000..76e2fad87d
--- /dev/null
+++ b/src/test/java/luke/parser/DateTimeParserTest.java
@@ -0,0 +1,86 @@
+package luke.parser;
+
+import luke.exception.DateException;
+import org.junit.jupiter.api.Test;
+
+import java.time.LocalDateTime;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class DateTimeParserTest {
+ @Test
+ public void testGetDateTime() throws DateException {
+ // Test date in the format of yyyy-MM-dd HH:mm
+ DateTimeParser date = new DateTimeParser("2024-02-25 13:00");
+ LocalDateTime expected = LocalDateTime.of(2024, 2, 25, 13, 0);
+ assertEquals(expected, date.getDateTime());
+
+ // Test date in the format of dd-MM-yyyy HH:mm
+ date = new DateTimeParser("25-02-2024 13:00");
+ assertEquals(expected, date.getDateTime());
+
+ // Test date in the format of yyyy/MM/dd HH:mm
+ date = new DateTimeParser("2024/02/25 13:00");
+ assertEquals(expected, date.getDateTime());
+
+ // Test date in the format of dd/MM/yyyy HH:mm
+ date = new DateTimeParser("25/02/2024 13:00");
+ assertEquals(expected, date.getDateTime());
+
+ // Test date in the format of dd/MM/yyyy HH
+ date = new DateTimeParser("25/02/2024 13");
+ assertEquals(expected, date.getDateTime());
+
+ // Test date in the format of yyyy-MM-dd (without time)
+ date = new DateTimeParser("2024-02-25");
+ expected = LocalDateTime.of(2024, 2, 25, 0, 0);
+ assertEquals(expected, date.getDateTime());
+
+ }
+
+ @Test
+ public void testGetDateTime_DateExceptionThrown() {
+ try {
+ DateTimeParser date = new DateTimeParser("2024-02-25 13:00:00");
+ } catch (DateException e) {
+ assertEquals("Sorry! The date is not in the correct format! :'(", e.getMessage());
+ }
+
+ try {
+ DateTimeParser date = new DateTimeParser("25-2-2024 13:00");
+ } catch (DateException e) {
+ assertEquals("Sorry! The date is not in the correct format! :'(", e.getMessage());
+ }
+
+ try {
+ DateTimeParser date = new DateTimeParser("Feb 25 2024 13:00");
+ } catch (DateException e) {
+ assertEquals("Sorry! The date is not in the correct format! :'(", e.getMessage());
+ }
+
+ try {
+ DateTimeParser date = new DateTimeParser("25/02/2024 1 PM");
+ } catch (DateException e) {
+ assertEquals("Sorry! The date is not in the correct format! :'(", e.getMessage());
+ }
+
+ try {
+ DateTimeParser date = new DateTimeParser("25-02/2024 13:00");
+ } catch (DateException e) {
+ assertEquals("Sorry! The date is not in the correct format! :'(", e.getMessage());
+ }
+
+ try {
+ DateTimeParser date = new DateTimeParser("2024/02/25 ");
+ } catch (DateException e) {
+ assertEquals("Sorry! The date is not in the correct format! :'(", e.getMessage());
+ }
+
+ try {
+ DateTimeParser date = new DateTimeParser("02/05");
+ } catch (DateException e) {
+ assertEquals("Sorry! The date is not in the correct format! :'(", e.getMessage());
+ }
+ }
+
+}
diff --git a/src/test/java/luke/task/TaskListTest.java b/src/test/java/luke/task/TaskListTest.java
new file mode 100644
index 0000000000..8b65329c6f
--- /dev/null
+++ b/src/test/java/luke/task/TaskListTest.java
@@ -0,0 +1,164 @@
+package luke.task;
+
+import luke.exception.DateException;
+import org.junit.jupiter.api.Test;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+
+public class TaskListTest {
+ @Test
+ public void testSize() throws DateException {
+ ArrayList list = new ArrayList<>();
+ TaskList taskList = new TaskList();
+ Todo todo = new Todo("read book");
+ Deadline deadline = new Deadline("return book", "2024-02-25 13:00");
+ Event event = new Event("project meeting", "2024-02-25 13:00", "2024-02-25 15:00");
+ taskList.add(todo);
+ taskList.add(deadline);
+ taskList.add(event);
+ list.add(todo);
+ list.add(deadline);
+ list.add(event);
+
+ // Test if the size of the list is correct
+ assertEquals(list.size(), taskList.size());
+
+ }
+
+ @Test
+ public void testAdd() throws DateException {
+ ArrayList list = new ArrayList<>();
+ TaskList taskList = new TaskList();
+ Todo todo = new Todo("read book");
+ Deadline deadline = new Deadline("return book", "2024-02-25 13:00");
+ Event event = new Event("project meeting", "2024-02-25 13:00", "2024-02-25 15:00");
+ taskList.add(todo);
+ taskList.add(deadline);
+ taskList.add(event);
+ list.add(todo);
+ list.add(deadline);
+ list.add(event);
+
+ // Test if the tasks are added to the list
+ assertEquals(3, taskList.size());
+ assertEquals(todo, taskList.get(0));
+ assertEquals(deadline, taskList.get(1));
+ assertEquals(event, taskList.get(2));
+ assertEquals(list.get(0), taskList.get(0));
+ assertEquals(list.get(1), taskList.get(1));
+ assertEquals(list.get(2), taskList.get(2));
+
+ }
+
+ @Test
+ public void testRemove() throws DateException {
+ ArrayList list = new ArrayList<>();
+ TaskList taskList = new TaskList();
+ Todo todo = new Todo("read book");
+ Deadline deadline = new Deadline("return book", "2024-02-25 13:00");
+ Event event = new Event("project meeting", "2024-02-25 13:00", "2024-02-25 15:00");
+ taskList.add(todo);
+ taskList.add(deadline);
+ taskList.add(event);
+ list.add(todo);
+ list.add(deadline);
+ list.add(event);
+
+ // remove deadline
+ taskList.remove(1);
+ list.remove(1);
+
+ // Test if the task is removed from the list
+ assertEquals(2, taskList.size());
+ assertEquals(todo, taskList.get(0));
+ assertEquals(event, taskList.get(1));
+ assertEquals(list, taskList.getList());
+
+ }
+
+ @Test
+ public void testMarkTask() throws DateException {
+ TaskList taskList = new TaskList();
+ Todo todo = new Todo("read book");
+ Deadline deadline = new Deadline("return book", "2024-02-25 13:00");
+ Event event = new Event("project meeting", "2024-02-25 13:00", "2024-02-25 15:00");
+ taskList.add(todo);
+ taskList.add(deadline);
+ taskList.add(event);
+
+ // mark deadline as done
+ taskList.markTask(1);
+ deadline.markAsDone();
+
+ // Test if the task is marked as done
+ assertEquals(deadline.getIsDone(), taskList.get(1).getIsDone());
+
+ }
+
+ @Test
+ public void testUnmarkTask() throws DateException {
+ TaskList taskList = new TaskList();
+ Todo todo = new Todo("read book");
+ Deadline deadline = new Deadline("return book", "2024-02-25 13:00");
+ Event event = new Event("project meeting", "2024-02-25 13:00", "2024-02-25 15:00");
+ taskList.add(todo);
+ taskList.add(deadline);
+ taskList.add(event);
+
+ // mark deadline as done
+ taskList.markTask(1);
+ deadline.markAsDone();
+
+ // unmark deadline as undone
+ taskList.unmarkTask(1);
+ deadline.markAsUndone();
+
+ // Test if the task is marked as undone
+ assertEquals(deadline.getIsDone(), taskList.get(1).getIsDone());
+
+ }
+
+ @Test
+public void testGetList() throws DateException {
+ ArrayList list = new ArrayList<>();
+ TaskList taskList = new TaskList();
+ Todo todo = new Todo("read book");
+ Deadline deadline = new Deadline("return book", "2024-02-25 13:00");
+ Event event = new Event("project meeting", "2024-02-25 13:00", "2024-02-25 15:00");
+ taskList.add(todo);
+ taskList.add(deadline);
+ taskList.add(event);
+ list.add(todo);
+ list.add(deadline);
+ list.add(event);
+
+ // Test if the list is returned correctly
+ assertEquals(list, taskList.getList());
+
+ }
+
+ @Test
+ public void testFind() throws DateException {
+ TaskList taskList = new TaskList();
+ Todo todo = new Todo("read book");
+ Deadline deadline = new Deadline("return book", "2024-02-25 13:00");
+ Event event = new Event("project meeting", "2024-02-25 13:00", "2024-02-25 15:00");
+ taskList.add(todo);
+ taskList.add(deadline);
+ taskList.add(event);
+
+ // find tasks with keyword "book"
+ TaskList foundList = taskList.find("book");
+
+ // Test if the tasks with keyword "book" are found
+ assertEquals(2, foundList.size());
+ assertEquals(todo, foundList.get(0));
+ assertEquals(deadline, foundList.get(1));
+
+ }
+
+}
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 657e74f6e7..9a74c2446b 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,7 +1,123 @@
-Hello from
- ____ _
-| _ \ _ _| | _____
-| | | | | | | |/ / _ \
-| |_| | |_| | < __/
-|____/ \__,_|_|\_\___|
-
+________________________________________________________________________
+Hello! I'm luke.luke
+What can I do for you?
+________________________________________________________________________
+________________________________________________________________________
+Hold up!! I am sorry, but I don't know what you mean by that :'(
+________________________________________________________________________
+________________________________________________________________________
+Hold up!! There must be a task to unmark!
+Please enter an index after unmark.
+________________________________________________________________________
+________________________________________________________________________
+Hold up!! There must be a task to mark!
+Please enter an index after mark.
+________________________________________________________________________
+________________________________________________________________________
+Hold up!! There must be a task to delete!
+Please enter an index after delete.
+________________________________________________________________________
+________________________________________________________________________
+Hold up!! The description of a todo cannot be empty.
+Please enter a description after your todo.
+________________________________________________________________________
+________________________________________________________________________
+Hold up!! The description of a deadline cannot be empty.
+Please enter a description after your deadline.
+________________________________________________________________________
+________________________________________________________________________
+Hold up!! The description of a event cannot be empty.
+Please enter a description after your event.
+________________________________________________________________________
+________________________________________________________________________
+Got it. I've added this task:
+ [T][ ] read book
+Now you have 1 task in the list.
+________________________________________________________________________
+________________________________________________________________________
+Got it. I've added this task:
+ [T][ ] go for a run
+Now you have 2 tasks in the list.
+________________________________________________________________________
+________________________________________________________________________
+Hold up!! The description of a deadline cannot be empty.
+Please follow this format: deadline /by .
+________________________________________________________________________
+________________________________________________________________________
+Got it. I've added this task:
+ [D][ ] homework (by: Sunday)
+Now you have 3 tasks in the list.
+________________________________________________________________________
+________________________________________________________________________
+Hold up!! The description of an event cannot be empty.
+Please follow this format: event /from /to .
+________________________________________________________________________
+________________________________________________________________________
+Got it. I've added this task:
+ [E][ ] project meeting (from: Sunday to: Tuesday)
+Now you have 4 tasks in the list.
+________________________________________________________________________
+________________________________________________________________________
+Here are the tasks in your list:
+1.[T][ ] read book
+2.[T][ ] go for a run
+3.[D][ ] homework (by: Sunday)
+4.[E][ ] project meeting (from: Sunday to: Tuesday)
+________________________________________________________________________
+________________________________________________________________________
+Nice! I've marked this task as done:
+[T][X] go for a run
+________________________________________________________________________
+________________________________________________________________________
+Here are the tasks in your list:
+1.[T][ ] read book
+2.[T][X] go for a run
+3.[D][ ] homework (by: Sunday)
+4.[E][ ] project meeting (from: Sunday to: Tuesday)
+________________________________________________________________________
+________________________________________________________________________
+Noted. I've removed this task:
+[D][ ] homework (by: Sunday)
+Now you have 3 tasks in the list.
+________________________________________________________________________
+________________________________________________________________________
+Here are the tasks in your list:
+1.[T][ ] read book
+2.[T][X] go for a run
+3.[E][ ] project meeting (from: Sunday to: Tuesday)
+________________________________________________________________________
+________________________________________________________________________
+Hold up!! There is no such task in the list.
+Please enter a valid index after delete.
+________________________________________________________________________
+________________________________________________________________________
+Noted. I've removed this task:
+[T][X] go for a run
+Now you have 2 tasks in the list.
+________________________________________________________________________
+________________________________________________________________________
+Here are the tasks in your list:
+1.[T][ ] read book
+2.[E][ ] project meeting (from: Sunday to: Tuesday)
+________________________________________________________________________
+________________________________________________________________________
+Nice! I've marked this task as done:
+[E][X] project meeting (from: Sunday to: Tuesday)
+________________________________________________________________________
+________________________________________________________________________
+Here are the tasks in your list:
+1.[T][ ] read book
+2.[E][X] project meeting (from: Sunday to: Tuesday)
+________________________________________________________________________
+________________________________________________________________________
+OK, I've marked this task as not done yet:
+[E][ ] project meeting (from: Sunday to: Tuesday)
+________________________________________________________________________
+________________________________________________________________________
+Here are the tasks in your list:
+1.[T][ ] read book
+2.[E][ ] project meeting (from: Sunday to: Tuesday)
+________________________________________________________________________
+________________________________________________________________________
+Bye! Hope to see you again soon!
+________________________________________________________________________
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index e69de29bb2..7968c72247 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -0,0 +1,26 @@
+blah
+unmark
+mark
+delete
+todo
+deadline
+event
+todo read book
+todo go for a run
+deadline homework
+deadline homework /by Sunday
+event project meeting
+event project meeting /from Sunday /to Tuesday
+list
+mark 2
+list
+delete 3
+list
+delete 4
+delete 2
+list
+mark 2
+list
+unmark 2
+list
+bye
\ No newline at end of file
diff --git "a/text-ui-test/runtest-Jasper\342\200\231s MacBook Air.sh" "b/text-ui-test/runtest-Jasper\342\200\231s MacBook Air.sh"
new file mode 100644
index 0000000000..1f93b1ba22
--- /dev/null
+++ "b/text-ui-test/runtest-Jasper\342\200\231s MacBook Air.sh"
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+# create bin directory if it doesn't exist
+if [ ! -d "../bin" ]
+then
+ mkdir ../bin
+fi
+
+# delete output from previous run
+if [ -e "./ACTUAL.TXT" ]
+then
+ rm ACTUAL.TXT
+fi
+
+# compile the code into the bin folder, terminates if error occurred
+if ! javac -cp ../src/main/java -Xlint:none -d ../bin ../src/main/java/*.java
+then
+ echo "********** BUILD FAILURE **********"
+ exit 1
+fi
+
+# run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT
+java -classpath ../bin Luke < input.txt > ACTUAL.TXT
+
+# convert to UNIX format
+cp EXPECTED.TXT EXPECTED-UNIX.TXT
+dos2unix ACTUAL.TXT EXPECTED-UNIX.TXT
+
+# compare the output to the expected output
+diff ACTUAL.TXT EXPECTED-UNIX.TXT
+if [ $? -eq 0 ]
+then
+ echo "Test result: PASSED"
+ exit 0
+else
+ echo "Test result: FAILED"
+ exit 1
+fi
\ No newline at end of file
diff --git a/text-ui-test/runtest.bat b/text-ui-test/runtest.bat
index 0873744649..7c294e6785 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 luke.luke < input.txt > ACTUAL.TXT
REM compare the output to the expected output
FC ACTUAL.TXT EXPECTED.TXT
diff --git a/text-ui-test/src/main/data/luke.txt b/text-ui-test/src/main/data/luke.txt
new file mode 100644
index 0000000000..00beb98342
--- /dev/null
+++ b/text-ui-test/src/main/data/luke.txt
@@ -0,0 +1,2 @@
+T:O:read book
+E:O:project meeting:Sunday:Tuesday