Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
eeda7cd
Level-0: Implemented Rename, Greet and Exit
adithyamangalam03 Sep 3, 2024
3dbc7ed
Level-1: Implemented Echo
adithyamangalam03 Sep 3, 2024
3545f8f
Level-2: Implemented Add & List
adithyamangalam03 Sep 4, 2024
c5937a0
Level-3: Implemented Mark/Unmark function for tasks
adithyamangalam03 Sep 4, 2024
a7ed3ec
Level-4: Implemented ToDo, Deadline & Event Functionality
adithyamangalam03 Sep 4, 2024
3c2e5a2
Level-4: Deadline output changed to omit 'deadline'
adithyamangalam03 Sep 5, 2024
f0acaa3
branch-Level-5: Added FlashException Class
adithyamangalam03 Sep 12, 2024
cc00e52
branch-Level-5: Added error handling to todo
adithyamangalam03 Sep 12, 2024
8e5f97c
Added error handling for event
adithyamangalam03 Sep 12, 2024
fad3efb
Added error handling for deadline
adithyamangalam03 Sep 12, 2024
2316c0b
Level-5: Implemented FlashException for error handling
adithyamangalam03 Sep 12, 2024
456b24b
Merge branch 'branch-Level-5'
adithyamangalam03 Sep 12, 2024
811769c
Implemented delete task function in branch-Level-6
adithyamangalam03 Oct 2, 2024
d05b803
Implemented new function for Level-7
adithyamangalam03 Oct 3, 2024
9024ae5
Merge branch 'branch-Level-6'
adithyamangalam03 Oct 3, 2024
febbce1
Merge branch 'branch-Level-7'
adithyamangalam03 Oct 3, 2024
8514320
Added exception handling for deleteTask with no task number
adithyamangalam03 Oct 4, 2024
63d3acc
Move task related classes into task package
adithyamangalam03 Oct 11, 2024
0d4b146
Refactor UI methods to UI class
adithyamangalam03 Oct 11, 2024
4ca10de
Move parsing methods to Parser class
adithyamangalam03 Oct 11, 2024
e340a54
Move methods on task list to TaskList class
adithyamangalam03 Oct 11, 2024
bbb61c9
Merge branch 'branch-A-MoreOOP'
adithyamangalam03 Oct 11, 2024
94d3b6e
Implement find function (level 9)
adithyamangalam03 Oct 11, 2024
60e059c
Merge branch 'branch-Level-9'
adithyamangalam03 Oct 11, 2024
a91164f
Add JavaDoc to all methods and classes
adithyamangalam03 Oct 11, 2024
2ef672d
Merge branch 'branch-A-JavaDoc'
adithyamangalam03 Oct 11, 2024
9474427
Add UserGuide
adithyamangalam03 Oct 11, 2024
d246758
Merge branch 'branch-A-UserGuide'
adithyamangalam03 Oct 11, 2024
07ca321
Update README.md
adithyamangalam03 Oct 11, 2024
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Ignore all class files
*.class

# IDEA files
/.idea/
/out/
Expand All @@ -15,3 +18,5 @@ bin/

/text-ui-test/ACTUAL.TXT
text-ui-test/EXPECTED-UNIX.TXT

/data/
11 changes: 11 additions & 0 deletions data/flash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
D | 0 | return book | June 6th
T | 1 | join sports club
T | 0 | complete project
T | 0 | test
T | 0 | test2
D | 0 | test2 | 1
T | 0 | test
D | 0 | test idk | 4
T | 0 | test test
D | 0 | djnsakj | dsnad
E | 0 | fdsnfds | dasdsa | fadda
249 changes: 235 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,251 @@
# Duke User Guide
# Flash Chatbot User Guide

// Update the title above to match the actual product name
Welcome to **Flash** - Your personal assistant chatbot designed to help you manage tasks efficiently, including todos, deadlines, and events.

// Product screenshot goes here
## Features

// Product intro goes here
### Add Task

## Adding deadlines
You can add three types of tasks:

// Describe the action and its outcome.
1. Todos - description only
2. Deadlines - description with a by date
3. Events - description with from and to dates

// Give examples of usage
### List Tasks

Example: `keyword (optional arguments)`
Display all tasks, encompassing todos, deadlines, and events, along with their respective statuses denoting completion or pending. Deadline tasks include the due date, while event tasks display both the start and end dates.

// A description of the expected outcome goes here
### Mark Task as Done

Mark any task as completed based on its list number.

### Mark Task as Incomplete

Restore any completed task to pending status based on its list number.

### Delete Task

Remove any task in the task list based on its list number.

### Find Tasks

Search for tasks by keywords in the task list.

### Save Data

All tasks are automatically saved as you add tasks. They will be loaded when you start the program again.

## Getting Started

### Prerequisites

Make sure you have Java 17 or above installed on your computer.

### Installation

1. Download the latest release of Flash from the releases page.
2. Extract the downloaded zip file to a folder on your computer.
3. Open a terminal and navigate to the folder where you extracted the zip file.
4. Run the following command to start the Flash application:

```bash
java -jar flash.jar
```
If the chatbot starts successfully, it will display the following welcome message:

```plaintext
---------------------------------------------------------------------------------------
Hello! I'm Flash
What can I do for you?
---------------------------------------------------------------------------------------
```

## Usage

### `todo` - Add a Todo Task

Adds a simple task with no additional information.

**Example of usage:**

```plaintext
todo Clean the Garage
```

A new Todo task "Clean the Garage" is added to your task list.

**Expected Outcome:**

```plaintext
---------------------------------------------------------------------------------------
Got it. I've added this task:
[T][ ] Clean the Garage
Now you have 1 task in the list.
---------------------------------------------------------------------------------------
```
expected output

### `deadline` - Add a Deadline Task

Adds a task with a by date which is the task's deadline.

**Example of usage:**

```plaintext
deadline Submit Report /by 03/15/2024 5:00 PM
```

## Feature ABC
**Expected Outcome:**
A new Deadline task "Submit Report" with the deadline "03/15/2024 5:00 PM" is added to your task list.

```plaintext
---------------------------------------------------------------------------------------
Got it. I've added this task:
[D][ ] Submit Report (by: 03/15/2024 5:00 PM)
Now you have 2 tasks in the list.
---------------------------------------------------------------------------------------
```

### `event` - Add an Event Task

Adds a task with from and to dates, indicating the period of time.

// Feature details
**Example of usage:**

```plaintext
event Team Meeting /from 03/10/2024 3:00 PM /to 03/10/2024 4:00 PM
```

**Expected Outcome:**
A new Event task "Team Meeting" from "03/10/2024 3:00 PM" to "03/10/2024 4:00 PM" is added to your task list.

```plaintext
---------------------------------------------------------------------------------------
Got it. I've added this task:
[E][ ] Team Meeting (from: 03/10/2024 3:00 PM to: 03/10/2024 4:00 PM)
Now you have 3 tasks in the list.
---------------------------------------------------------------------------------------
```

### `list` - List all Tasks

Displays all your tasks, including todos, deadlines, and events, along with their status (completed or pending).

**Example of usage:**

```plaintext
list
```

**Expected Outcome:**
All your tasks are displayed in a list format.

## Feature XYZ
```plaintext
---------------------------------------------------------------------------------------
Here are the tasks in your list:
1. [T][ ] Clean the Garage
2. [D][ ] Submit Report (by: 03/15/2024 5:00 PM)
3. [E][ ] Team Meeting (from: 03/10/2024 3:00 PM to: 03/10/2024 4:00 PM)
---------------------------------------------------------------------------------------
```

### `mark` - Mark Task as Completed

Marks a specific task as completed based on the list number provided.

**Example of usage:**

```plaintext
mark 1
```

**Expected Outcome:**
The first task in your list is marked as completed.

```plaintext
---------------------------------------------------------------------------------------
Nice! I've marked this task as done:
[T][X] Clean the Garage
---------------------------------------------------------------------------------------
```

### `unmark` - Mark Completed Task as Incomplete

Restores a completed task to pending status based on the list number provided.

**Example of usage:**

```plaintext
unmark 1
```

**Expected Outcome:**
The first task in your list is restored as pending.

```plaintext
---------------------------------------------------------------------------------------
OK, I've marked this task as not done yet:
[T][ ] Clean the Garage
---------------------------------------------------------------------------------------
```

### `delete` - Remove Task

Removes a specific task from the list based on the list number provided.

**Example of usage:**
The second task in your list is removed.

```plaintext
delete 2
```

**Expected Outcome:**

```plaintext
---------------------------------------------------------------------------------------
Noted. I've removed this task:
[D][ ] Submit Report (by: 03/15/2024 5:00 PM)
Now you have 2 tasks in the list.
---------------------------------------------------------------------------------------
```

### `find` - Find Tasks

Search for tasks by keywords in the task list.

**Example of usage:**

```plaintext
find Meeting
```

**Expected Outcome:**
All tasks containing the keyword “Meeting” are displayed.

```plaintext
---------------------------------------------------------------------------------------
Here are the matching tasks in your list:
1. [E][ ] Team Meeting (from: 03/10/2024 3:00 PM to: 03/10/2024 4:00 PM)
---------------------------------------------------------------------------------------
```

### `bye` - Exit the Program

Exits the program.

**Example of usage:**

```plaintext
bye
```

**Expected Outcome:**
The program exits.

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

// Feature details
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

86 changes: 86 additions & 0 deletions src/main/java/Flash.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import exception.FlashException;
import java.util.Scanner;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

well done. code functionality is implemented with well organized methods and with naming that describes the purpose well, and is in camelCase. if else statement is also in egyptian format


/**
* Main class for the Flash chatbot.
* Handles interaction with the user and manages tasks through commands.
*/
public class Flash {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To improve abstraction, you can refactor the code by separating task-related logic from the main control flow. One class can handle the application's control logic (user interaction, commands) while another class can be responsible for managing tasks (adding, deleting, marking, saving, etc.).


private static final String FILE_PATH = "./data/flash.txt";
private static Storage storage;
private static TaskList taskList;

/**
* The entry point of the application.
* Initializes storage and task list, loads tasks from the file,
* and continuously listens for user commands.
*
* @param args the command-line arguments
*/
public static void main(String[] args) {
storage = new Storage(FILE_PATH);
taskList = new TaskList();

// Load tasks from file
try {
taskList.tasks = storage.load();
UI.displayLoadSuccessMessage();
} catch (FlashException e) {
System.out.println("Failed to load tasks: " + e.getMessage());
}

Scanner in = UI.readCommand();
UI.displayWelcomeMessage();

while (true) {
try {
String input = in.nextLine();
String command = Parser.parseCommand(input);

switch (command) {
case "bye":
UI.displayByeMessage();
return;
case "list":
UI.displayTasks(taskList.tasks);
break;
case "mark":
taskList.markTask(input);
storage.save(taskList.tasks);
break;
case "unmark":
taskList.unMarkTask(input);
storage.save(taskList.tasks);
break;
case "todo":
taskList.addTodo(input);
storage.save(taskList.tasks);
break;
case "deadline":
taskList.addDeadline(input);
storage.save(taskList.tasks);
break;
case "event":
taskList.addEvent(input);
storage.save(taskList.tasks);
break;
case "delete":
taskList.deleteTask(input);
storage.save(taskList.tasks);
break;
case "find":
taskList.listMatchedTasks(input);
break;
default:
throw new FlashException("Uh-oh! I don't know what that means.");
}
} catch (FlashException e) {
System.out.println("____________________________________________________________");
System.out.println(e.getMessage());
System.out.println("____________________________________________________________");
}
}
}

}
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: Flash

Loading