-
Notifications
You must be signed in to change notification settings - Fork 114
[AdiMangalam] ip #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[AdiMangalam] ip #111
Changes from all commits
eeda7cd
3dbc7ed
3545f8f
c5937a0
a7ed3ec
3c2e5a2
f0acaa3
cc00e52
8e5f97c
fad3efb
2316c0b
456b24b
811769c
d05b803
9024ae5
febbce1
8514320
63d3acc
0d4b146
4ca10de
e340a54
bbb61c9
94d3b6e
60e059c
a91164f
2ef672d
9474427
d246758
07ca321
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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 |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import exception.FlashException; | ||
| import java.util.Scanner; | ||
|
|
||
| /** | ||
| * Main class for the Flash chatbot. | ||
| * Handles interaction with the user and manages tasks through commands. | ||
| */ | ||
| public class Flash { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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("____________________________________________________________"); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Manifest-Version: 1.0 | ||
| Main-Class: Flash | ||
|
|
There was a problem hiding this comment.
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