Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d411f2a
Add pull request 1
karishma-t Sep 7, 2023
758863c
Add Level-0 - Rename, Greet, Exit.
karishma-t Sep 7, 2023
3115910
Add Level 1 echo
karishma-t Sep 7, 2023
d97f8cf
Add level-2
karishma-t Sep 7, 2023
4a96d47
Add level-3
karishma-t Sep 7, 2023
2b5ef00
Add level-4
karishma-t Sep 15, 2023
3edf721
Add error handling and exceptions
karishma-t Oct 3, 2023
98652d7
Add Level-6
karishma-t Oct 4, 2023
eb53e6c
A-CodingStandard
karishma-t Oct 4, 2023
92d18e3
Add Level-7
karishma-t Oct 4, 2023
a362da3
Add A-Jar
karishma-t Oct 4, 2023
9063cb1
Add Classes
karishma-t Oct 5, 2023
846da7b
Add support for saving dates
karishma-t Oct 5, 2023
199eacc
Add Level-9
karishma-t Oct 5, 2023
dbb8e86
Add Javadoc
karishma-t Oct 5, 2023
6c3d74d
Merge pull request #1 from karishma-t/branch-Level-9
karishma-t Oct 5, 2023
2d3ddff
Add User Guide for chatbot
karishma-t Oct 5, 2023
ec4f1a2
Add feature summary to readme
karishma-t Oct 5, 2023
d74c4c6
Merge pull request #2 from karishma-t/branch-A-JavaDoc
karishma-t Oct 5, 2023
3ae016a
Add comments for main
karishma-t Oct 6, 2023
0ddd375
Add class for exception
karishma-t Oct 6, 2023
fa5d740
Update README.md
karishma-t Oct 9, 2023
1b9e891
Add classes for commands and add unmark task
karishma-t Oct 24, 2023
ac6605a
Add class for AddComand and modify parser
karishma-t Oct 24, 2023
51df475
Add checks for empty event/deadline dates
karishma-t Oct 25, 2023
2b9826e
Add common check for mark/unmark
karishma-t Oct 25, 2023
c9f2dc5
Modify delete command
karishma-t Oct 25, 2023
3313f0d
Modify readme
karishma-t Oct 25, 2023
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
138 changes: 114 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,114 @@
# 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.

## Setting up in Intellij

Prerequisites: JDK 11, update Intellij to the most recent version.

1. Open Intellij (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project first)
1. Open the project into Intellij as follows:
1. Click `Open`.
1. Select the project directory, and click `OK`.
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).<br>
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:
```
Hello from
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
```

# User Guide for Ken

```
K K EEEEE N N
K K E NN N
KKK EEEE N N N
K K E N NN
K K EEEEE N N
```
## Features
Ken is a CLI chatbot that helps you manage your tasks efficiently. Easily add and delete tasks, deadline and events, save them, and use Ken to manage them easily.

## Usage

### `todo, deadline, event` - Add a Task

To add a task, use one of the following commands:

- `todo [task description]`: Adds a todo task.
- `deadline [task description] /by [deadline]`: Adds a deadline task, with when it is due by.
- `event [task description] /from [start date] /to [end date]`: Adds an event task, with the duration of the event.

#### Example of usage :

`todo activity`

`deadline project /by Friday`

`event lunch /from 2pm /to 4pm`


#### Expected outcome:

```
Got it. I've added this task:
[T][ ] activity
Now you have 1 tasks in the list.
```
```
Got it. I've added this task:
[D][ ] project by: Friday
Now you have 4 tasks in the list.
```
```
Got it. I've added this task:
[E][ ] lunch from: 2pm to: 4pm
Now you have 5 tasks in the list.
```


### `list` - Viewing all tasks

To view a list of all your tasks and their corresponding information, use this command

`list`

#### Expected outcome:


```
Here are the tasks in your list:
1.[T][ ] studying for test
2.[D][ ] project by: Friday
3.[E][ ] lunch from: 2pm to: 4pm
```


### `delete` - Removing tasks

To delete a task, use the delete command followed by the task number:

`delete 2`

#### Expected outcome:


```
Got it. I've removed this task:
[D][ ] project by: Friday
Now you have 2 tasks in the list.
```
### `find` - Searching for tasks by keywords

To find a particular task and their corresponding information from the list by using any part of description, use this command

`find lunch`

#### Expected outcome:


```
Here are the matching tasks in your list:
2. [E][ ] lunch ( from: 2pm to: 4pm )
```


### `mark` - Searching for tasks by keywords

To mark a task as done, use the mark command followed by the task number:

#### Example of usage :

`mark 2`

#### Expected outcome:

```
Nice! I've marked this task as done:
[X] lunch from: 2pm to: 4pm
```



1 change: 1 addition & 0 deletions data/ken.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
T | 0 | it works!!!!!!
136 changes: 123 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,139 @@
# User Guide
# User Guide for Ken

```
K K EEEEE N N
K K E NN N
KKK EEEE N N N
K K E N NN
K K EEEEE N N
```
## Features
Ken is a CLI chatbot that helps you manage your tasks efficiently. Easily add and delete tasks, deadline and events, save them, and use Ken to manage them easily.

### Feature-ABC
- Add tasks of different types: Todo, Deadline, Event
- List all your tasks
- Mark tasks as done
- Unmark tasks
- Delete tasks
- Find tasks

Description of the feature.
## Usage

### Feature-XYZ
### `todo, deadline, event` - Add a Task

Description of the feature.
To add a task, use one of the following commands:

## Usage
- `todo [task description]`: Adds a todo task.
- `deadline [task description] /by [deadline]`: Adds a deadline task, with when it is due by.
- `event [task description] /from [start date] /to [end date]`: Adds an event task, with the duration of the event.

#### Example of usage :

`todo activity`

`deadline project /by Friday`

`event lunch /from 2pm /to 4pm`


#### Expected outcome:

```
Got it. I've added this task:
[T][ ] activity
Now you have 1 tasks in the list.
```
```
Got it. I've added this task:
[D][ ] project by: Friday
Now you have 4 tasks in the list.
```
```
Got it. I've added this task:
[E][ ] lunch from: 2pm to: 4pm
Now you have 5 tasks in the list.
```

### `Keyword` - Describe action

Describe the action and its outcome.
### `list` - Viewing all tasks

Example of usage:
To view a list of all your tasks and their corresponding information, use this command

`list`

`keyword (optional arguments)`
#### Expected outcome:

Expected outcome:

Description of the outcome.
```
Here are the tasks in your list:
1.[T][ ] studying for test
2.[D][ ] project by: Friday
3.[E][ ] lunch from: 2pm to: 4pm
```


### `delete` - Removing tasks

To delete a task, use the delete command followed by the task number:

`delete 2`

#### Expected outcome:


```
expected output
Got it. I've removed this task:
[D][ ] project by: Friday
Now you have 2 tasks in the list.
```
### `find` - Searching for tasks by keywords

To find a particular task and their corresponding information from the list by using any part of description, use this command

`find lunch`

#### Expected outcome:


```
Here are the matching tasks in your list:
2. [E][ ] lunch ( from: 2pm to: 4pm )
```


### `mark` - Marking tasks as completed

To mark a task as done, use the mark command followed by the task number:

#### Example of usage :

`mark 2`

#### Expected outcome:

```
Nice! I've marked this task as done:
[X] lunch from: 2pm to: 4pm
```


### `unmark` - Unmarking tasks as uncompleted

To unmark a previously marked task, use the unmark command followed by the task number:

#### Example of usage :

`unmark 2`

#### Expected outcome:

```
Nice! I've unmarked this task as done:
[ ] lunch from: 2pm to: 4pm
```


### `bye` - Terminating Ken

When you've finished organizing your tasks, simply enter
`bye`
2 changes: 2 additions & 0 deletions ken.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
D | 1 | ip | by: friday
T | 0 | studying for test | null
1 change: 1 addition & 0 deletions pullreq1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pull request 1
86 changes: 86 additions & 0 deletions src/main/java/AddCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
public class AddCommand {
/**
* Handles the addition of a task to the task list.
*
* @param taskType The type of the task (e.g., "T" for Todo).
* @param taskDescription The description of the task.
* @param taskList The TaskList to which the task will be added.
* @throws EmptyDescriptionException If the task description is empty.
* @throws MissingInfoException If required information is missing for a task type.
*/
public static void AddTask(String taskType, String taskDescription, TaskList taskList) throws EmptyDescriptionException, MissingInfoException {
if (taskDescription.isEmpty()) {
throw new EmptyDescriptionException("Hey!! Description cannot be empty for a " + taskType + " task.");
}
taskType = taskType.substring(0, 1).toUpperCase();
String[] dateInfo = CommandParser.extractDateInfo(taskDescription);
if (isMissingInfo(taskType, dateInfo)) {
throw new MissingInfoException(taskType);
}
taskDescription = dateInfo[0];
addTaskToList(taskType, taskDescription, dateInfo[1], taskList);
displayTaskAddedMessage(taskType, taskDescription, dateInfo[1], taskList);
}

/**
* Checks if required information is missing for a task type.
*
* @param taskType The type of the task.
* @param dateInfo An array containing task description and date information.
* @return True if required information is missing, otherwise false.
*/
private static boolean isMissingInfo(String taskType, String[] dateInfo) {
if (taskType.equals("D") && dateInfo[1] == null) {
return true;
} else return taskType.equals("E") && (dateInfo[1] == null || dateInfo[1].isEmpty());
}

/**
* Adds a task to the task list.
*
* @param taskType The type of the task.
* @param taskDescription The description of the task.
* @param dateInfo The date information for the task.
* @param taskList The TaskList to which the task will be added.
*/
private static void addTaskToList(String taskType, String taskDescription, String dateInfo, TaskList taskList) {
taskList.getTaskTypes().add(taskType);
taskList.getTaskDates().add(dateInfo);
taskList.getTaskDescriptions().add(taskDescription.trim());
taskList.getTaskDoneStatus().add(false);
}

/**
* Displays a message confirming the addition of a task.
*
* @param taskType The type of the task.
* @param taskDescription The description of the task.
* @param dateInfo The date information for the task.
* @param taskList The TaskList to which the task was added.
*/
private static void displayTaskAddedMessage(String taskType, String taskDescription, String dateInfo, TaskList taskList) {
System.out.println(" Got it. I've added this task:");
String dateInfoText = dateInfo != null ? " " + dateInfo : "";
System.out.println(" [" + taskType + "][ ] " + taskDescription + dateInfoText);
System.out.println(" Now you have " + taskList.getTaskDescriptions().size() + " tasks in the list.");
}

/**
* Handles adding a task and saves tasks after adding it.
*
* @param taskType The type of the task (e.g., "T" for Todo).
* @param taskDescription The description of the task.
* @param taskList The TaskList to which the task will be added.
* @throws KenException If there's an issue with the task or task list handling.
*/
public static void handleAddTask(String taskType, String taskDescription, TaskList taskList) throws KenException {
AddTask(taskType, taskDescription, taskList);
Storage.saveTasks(taskList); // Save tasks after deleting
}

public static class MissingInfoException extends KenException {
public MissingInfoException(String taskType) {
super("Hey!! Don't leave the description or date empty for a " + taskType + " task.");
}
}
}
Loading