Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a8435c7
Level-0
Jan 31, 2025
1f4bfd9
Revert "Level-0"
Feb 7, 2025
0144f1c
Reapply "Level-0"
Feb 7, 2025
e3bd341
Enable ability to echo user's input, exit when it is bye
Feb 7, 2025
7ce0ae2
Enable the ability to store user's inputs and display them when reque…
Feb 7, 2025
0643a10
Add functions to mark and unmark tasks, while adopting a Task class t…
Feb 7, 2025
9ac4899
Optimise the way of getting input and check if the code aligns with c…
Feb 7, 2025
dd8334e
Using inheritance to support tracking 3 types of tasks: Todo, Deadlin…
Feb 14, 2025
cb07f89
Added some exceptions for dealing with errors,
Feb 14, 2025
6771044
Using ArrayList<Task> instead of an array to store tasks and turned T…
Feb 21, 2025
1eea51f
Enabled deleting tasks from the list by task index
Feb 21, 2025
02b0f40
Replaced taskCounter with taskList.size() and utilised taskList.getLa…
Mar 6, 2025
4f3ad6c
Created a new class Storage to deal with loading and saving tasks in …
Mar 6, 2025
9be6807
Made amendments in parseTaskFromString() so that there is no reassign…
Mar 6, 2025
9902379
Merge branch 'branch-Level-6'
Mar 6, 2025
217a2dd
Merge branch 'branch-Level-7'
Mar 6, 2025
5d4692d
Added loadTasks() and saveTasks() into main() to complete the task sa…
Mar 6, 2025
bd41e9f
Fixed the issue of displaying wrong no. of tasks in deleteTask()
Mar 6, 2025
a8c554c
Implemented a new class TaskList to contain the task list in Elyk and…
Mar 14, 2025
934cd37
Implemented class Ui but yet to incorporate its methods in other classes
Mar 14, 2025
27f12a9
Completed implementing all new classes for OOP and modified the logic…
Mar 14, 2025
ef12c47
Added "find" command case and method to extract keyword in Parser class
Mar 14, 2025
bc5e903
Updated Ui and TaskList classes to find and display matching tasks ac…
Mar 14, 2025
21a639f
Updated main logic in Elyk to support finding tasks by a keyword
Mar 14, 2025
3dc8f6a
Added JavaDoc comments to the Ui class and all of its methods
Mar 14, 2025
f5a0f9d
Added JavaDoc comments to 3 more classes and all of their non-private…
Mar 14, 2025
03f4d46
Completed the remaining JavaDoc comments for all classes and methods
Mar 14, 2025
071a94a
Merge pull request #1 from paklongchiu/branch-Level-9
paklongchiu Mar 14, 2025
620b83e
Merge branch 'master' into branch-A-JavaDoc
Mar 14, 2025
1c329ea
Merge pull request #2 from paklongchiu/branch-A-JavaDoc
paklongchiu Mar 14, 2025
9cc84c0
Explained the 9 main features of Elyk in UG
Mar 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Duke project template
# Elyk 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.

Expand All @@ -13,7 +13,7 @@ Prerequisites: JDK 17, update Intellij to the most recent version.
1. If there are any further prompts, accept the defaults.
1. Configure the project to use **JDK 17** (not other versions) as explained in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).<br>
In the same dialog, set the **Project language level** field to the `SDK default` option.
1. 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:
1. After that, locate the `src/main/java/Elyk.java` file, right-click it, and choose `Run Elyk.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
____ _
Expand Down
158 changes: 144 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,160 @@
# Duke User Guide
# Elyk User Guide

// Update the title above to match the actual product name
Elyk is a Personal Assistant Chatbot that acts as a task manager to
helps users keep track of their tasks via a command line interface (CLI).

// Product screenshot goes here
## Adding ToDos

// Product intro goes here
This feature allows users to add and track tasks that are without any date/time
attached to it, e.g., visit a museum, which are represented by the symbol "T".

## Adding deadlines
Input format: `todo <task description>`

// Describe the action and its outcome.
Example: `todo visit a museum`

// Give examples of usage
Expected output:

Example: `keyword (optional arguments)`
```
Got it. I've added this task:
[T][ ] visit a museum
Now you have 5 tasks in the list.
```

## Adding Deadlines

This feature allows users to add and track tasks that need to be done before a
specific date/time, e.g., finish proposal by 04/06/2025 9pm, which are represented
by the symbol "D".

// A description of the expected outcome goes here
Input format: `deadline <task description> /by <deadline>`

Example: `deadline finish proposal /by 04/06/2025 9pm`

Expected output:

```
expected output
Got it. I've added this task:
[D][ ] finish proposal (by: 04/06/2025 9pm)
Now you have 3 tasks in the list.
```

## Feature ABC
## Adding Events

This feature allows users to add and track tasks that start at a specific date/time
and ends at a specific date/time, e.g., basketball training 3-6pm, which are represented
by the symbol "E".

Input format: `event <task description> /from <start time> /to <end time>`

Example: `event basketball training /from 3pm /to 6pm`

Expected output:

```
Got it. I've added this task:
[E][ ] basketball training (from: 3pm to: 6pm)
Now you have 7 tasks in the list.
```

## Listing tasks

This feature allows users to view all the tasks that have been stored by Elyk.

Input format: `list`

Example: `list`

Expected output:

```
Here are the tasks in your list:
1.[T][X] visit a museum
2.[D][ ] finish proposal (by: 04/06/2025 9pm)
3.[E][ ] basketball training (from: 3pm to: 6pm)
4.[T][X] eat dinner
5.[T][ ] fitness exercises
```

## Marking tasks as Done

This feature allows users to mark tasks as done, which are represented
by the symbol "X".

Input format: `mark <task index>`

Example: `mark 3`

Expected output:

```
Nice! I've marked this task as done:
[E][X] basketball training (from: 3pm to: 6pm)
```

// Feature details
## Marking tasks as Not Done

This feature allows users to mark tasks as done, which are represented
by the symbol " ".

## Feature XYZ
Input format: `unmark <task index>`

Example: `unmark 1`

Expected output:

```
OK, I've marked this task as not done yet:
[T][ ] visit a museum
```

## Deleting tasks

This feature allows users to delete tasks that have been stored by Elyk.

Input format: `delete <task index>`

Example: `delete 2`

Expected output:

```
Noted. I've removed this task:
[D][ ] finish proposal (by: 04/06/2025 9pm)
Now you have 4 tasks in the list.
```

## Finding tasks

This feature allows users to search for tasks that contain a certain keyword
in the description.

Input format: `find <keyword>`

Example: `find run`

Expected output:

```
Here are the matching tasks in your list:
1.[T][X] run 10k
2.[T][ ] run 5k
3.[T][ ] charity run
4.[D][ ] slow run (by: 5pm)
5.[E][X] running exercise (from: 6pm to: 10pm)
```

## Exiting the program

This feature allows users to say bye to Elyk and exit the chatbot program.

Input format: `bye`

Example: `bye`

Expected output:

```
Bye. Hope to see you again soon!

// Feature details
Process finished with exit code 0
```
28 changes: 28 additions & 0 deletions src/main/java/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* A child class of Task class that contains the description and deadline of the tasks
*/
public class Deadline extends Task {

protected String by;

/**
* Constructor of Deadline class
*
* @param description descriptionof the task
* @param by deadline of the task
*/
public Deadline(String description, String by) {
super(description);
this.by = by;
}

/**
* Converts the task to printable String argument
*
* @return a String representing the task
*/
@Override
public String toString() {
return "[D]" + super.toString() + " (by: " + by + ")";
}
}
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

111 changes: 111 additions & 0 deletions src/main/java/Elyk.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/**
* The main class of task manager: Elyk, which controls all the executions of the main program by
* utilising the functionality of all the other classes.
*/
public class Elyk {
public static int taskNum = 0;
public static String input = "";
public static String description = "";
public static String from = "";
public static String to = "";
public static String by = "";
public static String keyword = "";
private static Storage storage;
private static TaskList taskList;
private static Ui ui;

/**
* Constructor of Elyk class which initialises a Storage, TaskList and Ui
*
* @param elykFile path of the file used to load and save tasks
*/
public Elyk(String elykFile) {
ui = new Ui();
storage = new Storage(elykFile);
taskList = storage.loadTasks();
}

public static void main(String[] args) {
new Elyk("data/Elyk.txt").run();
}

/**
* Runs all the features that the task manager Elyk contains
*/
public void run() {
ui.greet();

while (true) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of while(true), maybe you can consider using this instead:

do {
// code to run
}
while (!input.equal("bye"));

try {
input = ui.getNextCommand();
String commandType = Parser.updateCommand(input);
switch (commandType) {
case "bye":
ui.sayBye();
System.exit(0);
case "list":
ui.printTasks();
for (int i = 0; i < taskList.size(); i++) {
ui.printIndividualTask(taskList.getTask(i), i);
}
break;
case "mark":
taskNum = Parser.getTaskNum(input);
Task doneTask = taskList.getTask(taskNum - 1);
doneTask.markAsDone();
ui.markTaskDone(doneTask);
storage.saveTasks(taskList);
break;
case "unmark":
taskNum = Parser.getTaskNum(input);
Task notDoneTask = taskList.getTask(taskNum - 1);
notDoneTask.markAsNotDone();
ui.markTaskNotDone(notDoneTask);
storage.saveTasks(taskList);
break;
case "delete":
taskNum = Parser.getTaskNum(input);
Task deletedTask = taskList.removeTask(taskNum - 1);
ui.deleteTask(deletedTask, taskList.size());
storage.saveTasks(taskList);
break;
case "todo":
description = Parser.getDescription(input, "todo");
Task addedTodo = taskList.addTask(new Todo(description));
ui.inputTask(addedTodo, taskList.size());
storage.saveTasks(taskList);
break;
case "deadline":
description = Parser.getDescription(input, "deadline");
by = Parser.getBy(input);
Task addedDeadline = taskList.addTask(new Deadline(description, by));
ui.inputTask(addedDeadline, taskList.size());
storage.saveTasks(taskList);
break;
case "event":
description = Parser.getDescription(input, "event");
from = Parser.getFrom(input);
to = Parser.getTo(input);
Task addedEvent = taskList.addTask(new Event(description, from, to));
ui.inputTask(addedEvent, taskList.size());
storage.saveTasks(taskList);
break;
case "find":
keyword = Parser.getKeyword(input);
TaskList foundTasks = taskList.findMatchingTasks(keyword);
ui.printMatchingTasks();
for (int i = 0; i < foundTasks.size(); i++) {
ui.printIndividualTask(foundTasks.getTask(i), i);
}
break;
default:
throw new ElykException();
}
} catch (ElykException e) {
ui.printErrorMessage(" Sorry :( I currently does not support this command, please try again.");
} catch (IndexOutOfBoundsException e) {
ui.printErrorMessage(" Hmm... There might be some missing information in your command...");
}
}
}
}
3 changes: 3 additions & 0 deletions src/main/java/ElykException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public class ElykException extends Exception {

}
31 changes: 31 additions & 0 deletions src/main/java/Event.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* A child class of Task class that contains the description, start and end time of the tasks
*/
public class Event extends Task {

protected String from;
protected String to;

/**
* Constructor of Event class
*
* @param description description of the task
* @param from start time of the task
* @param to end time of the task
*/
public Event(String description, String from, String to) {
super(description);
this.from = from;
this.to = to;
}

/**
* Converts the task to printable String argument
*
* @return a String representing the task
*/
@Override
public String toString() {
return "[E]" + super.toString() + " (from: " + from + " to: " + to + ")";
}
}
3 changes: 3 additions & 0 deletions src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: Elyk

Loading