Skip to content
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

[javienneyeo] ip #215

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2133998
Greet and exit
javienneyeo Jan 31, 2023
aebbd76
Greet, echo and exit
javienneyeo Jan 31, 2023
c9dce36
Add elements into a list
javienneyeo Feb 1, 2023
7c733ca
added list to store items
javienneyeo Feb 3, 2023
1aa5dc0
added mark as done functionality
javienneyeo Feb 3, 2023
cd54a1e
added todo, event and deadline
javienneyeo Feb 8, 2023
33428da
handle exceptions in commands
javienneyeo Feb 15, 2023
983890b
shift classes into packages
javienneyeo Feb 15, 2023
fe58087
merge branch-A-Packages
javienneyeo Feb 15, 2023
d919bc1
added delete task functionality
javienneyeo Feb 26, 2023
94c8e08
Merge branch 'branch-Level-6'
javienneyeo Feb 26, 2023
f0554aa
store the data in txt file
javienneyeo Feb 27, 2023
1792a0b
cleaned up code for storage
javienneyeo Feb 27, 2023
e067a36
resolve merge conflict
javienneyeo Feb 27, 2023
dde6faf
merge 'branch-Level-7'
javienneyeo Feb 27, 2023
a3e5838
added Ui class
javienneyeo Feb 28, 2023
8bb6a12
added Parser and TaskList classes
javienneyeo Feb 28, 2023
48805a0
added find task functionality
javienneyeo Feb 28, 2023
a27c740
Merge pull request #1 from javienneyeo/branch-Level-9
javienneyeo Feb 28, 2023
b4f2ebf
added documentation to the code
javienneyeo Mar 3, 2023
4e684b7
added user guide
javienneyeo Mar 3, 2023
e6b9e70
edited user guide
javienneyeo Mar 3, 2023
54766f3
changed the alignment of user guide
javienneyeo Mar 3, 2023
1474f6e
changed duke to expected output
javienneyeo Mar 3, 2023
a1ba4ea
dealt with a few more exceptions
javienneyeo Mar 3, 2023
ac1e054
changed code for format task
javienneyeo Mar 3, 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
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
# duke.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.

Expand All @@ -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).<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:
3. After that, locate the `src/main/java/duke.Duke.java` file, right-click it, and choose `Run duke.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
____ _
Expand Down
Empty file added data/duke.txt
Empty file.
165 changes: 151 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,166 @@
# User Guide
# User Guide for Duke

## Features
## Features of Duke
1. [Add a Task into the List](#add-a-task-into-the-list)
2. [Removing a Task from the List](#removing-a-task-from-the-list)
3. [Changing the Status of a Task](#changing-the-status-of-a-task)
4. [View all Tasks in the List](#view-all-tasks-in-the-list)
5. [Finding a Task in the List](#finding-a-task-in-the-list)
6. [Exiting Duke](#exiting-duke)

### Feature-ABC
### Add a Task into the List
1. ``todo``
- this command allows users to add a task that does not specify a time or date

Description of the feature.
#### Format of Input

### Feature-XYZ
```
todo buy bread
```

#### Expected Output:
```
Got it. I've added this task:
[T][ ] buy bread
You currently have 1 tasks in your list.
```

2. ``deadline``
- This command allows users to add a task that needs to be done before a specific date or time

#### Format of Input

```
deadline finish tuna sandwich /by monday
```

#### Expected Output:
```
Got it. I've added this task:
[D][ ] finish tuna sandwich (by: monday)
You currently have 1 tasks in your list.
```

3. ``event``
- This command allows users to add a task that starts and ends at a specific date or time

#### Format of Input

```
event family dinner at joyden /from 6pm /to 9pm
```

#### Expected Output:
```
Got it. I've added this task:
[E][ ] family dinner at joyden (from: 6pm to: 9pm)
You currently have 1 tasks in your list.
```

### Removing a Task from the List
``delete``
- This command allows users to delete a task from the list
- The number after the command is the index of the task in the list

#### Format of Input

```
delete 3
```

#### Expected Output:
```
Noted. I've removed this task:
[T][ ] sell fridge
You currently have 2 tasks in your list.
```

Description of the feature.
### Changing the Status of a Task
1. ``mark``
- This command allows users to mark a task as done
- The number after the command is the index of the task in the list
- The task on the list will be updated from `[ ]` to `[X]`

## Usage
#### Format of Input

### `Keyword` - Describe action
```
mark 1
```

Describe the action and its outcome.
#### Expected Output:
```
Nice! I've marked this task as done:
Here are the tasks in your list:
1. [T][X] pump petrol
```

Example of usage:
2. ``unmark``
- This command allows users to mark a task as not done
- The number after the command is the index of the task in the list
- The task on the list will be updated from `[X]` to `[ ]`

`keyword (optional arguments)`
#### Format of Input

Expected outcome:
```
unmark 1
```

Description of the outcome.
#### Expected Output:
```
OK, I've marked this task as not done yet:
Here are the tasks in your list:
1. [T][ ] pump petrol
```

### View all Tasks in the List
``list``
- This command allows users to see all tasks in their list
- Task of type `todo` will be displayed: `[T][ ] TASK_NAME`
- Task of type `deadline` will be displayed: `[D][ ] TASK_NAME (by: DATE)`
- Task of type `event` will be displayed: `[E][ ] TASK_NAME (from: START_DATE to: END_DATE)`

#### Format of Input

```
list
```

#### Expected Output:
```
Here are the tasks in your list:
1. [T][ ] paint a portrait of a horse
2. [D][ ] buy christmas presents (by: christmas)
3. [T][X] decorate christmas tree
```

### Finding a Task in the List
``find``
- This command allows users to see all tasks that contains the keyword in their list

#### Format of Input

```
find beef
```

#### Expected Output:
```
Here are the matching tasks in your list:
1. [D][ ] cook beef shank (by: friday)
2. [E][ ] beef noodle party (from: 2am to: 5am)
```

### Exiting Duke
``bye``
- This command allows users to exit the programme

#### Format of Input

```
bye
```

#### Expected Output:
```
expected output
Bye! Hope to see you again soon!
```
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

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: duke.Duke

36 changes: 36 additions & 0 deletions src/main/java/duke/Duke.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package duke;

import duke.tasks.Task;
import duke.exceptions.EmptyDescriptionException;
import duke.exceptions.TaskToMarkDoesNotExistException;
import duke.exceptions.UnknownCommandException;

import java.io.IOException;
import java.util.ArrayList;


/**
* Main class of Duke that contains code for Duke to function
*/
public class Duke {

public static void main(String[] args) {
Ui.printGreet();
ArrayList<Task> tasks = TaskList.tasks;
try {
tasks = Storage.getData();
} catch (IOException e) {
System.out.println("Error obtaining data from file");
}
try {
TaskList.editList();
} catch (UnknownCommandException e) {
e.printErrorMessage();
} catch (EmptyDescriptionException e) {
e.printErrorMessage();
} catch (TaskToMarkDoesNotExistException e) {
e.printErrorMessage();
Ui.printNumberOfTasks(tasks);
}
}
}
20 changes: 20 additions & 0 deletions src/main/java/duke/Parser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package duke;

import java.util.Scanner;

/**
* Deals with loading tasks from the file and saving tasks in the file
*/
public class Parser {

/**
* Takes in the user input and split the sentence into 2 parts by the " "
*
* @param input line that user has inputted
* @return an array of Strings that contains the command at index 0 and the description of the task at index 1
*/
public static String[] parse(Scanner input) {
String text = input.nextLine(); // input the whole sentence into text
return text.split(" ", 2);
}
}
Loading