Skip to content

Commit

Permalink
Merge pull request #70 from Zeno-Zr/LimZhengRong-Documentation
Browse files Browse the repository at this point in the history
Update Dish commands for UG and DG
  • Loading branch information
Zeno-Zr authored Mar 28, 2023
2 parents 66c5374 + 7f2267a commit 8844a42
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 13 deletions.
5 changes: 4 additions & 1 deletion docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ request to `Manager` to assist the CRUD operations.

##### The command component consists of the following:

![](./uml/CommandPackageDiagram.png)
![Command_Package_Diagram](./uml/CommandPackageDiagram.png)

- 4 subcomponents: Command, HelpCommand, ExitCommand, IncorrectCommand

Expand Down Expand Up @@ -143,6 +143,9 @@ The `Staff` Feature allows user to create, read, update, delete (CRUD) `Staff` o
The Dish feature consists of three functions:

##### Adding dish to list:

![](./uml/AddDishCommandSequenceDiagram-Add_Dish_Sequence_Diagram.png)

- When the ```AddDishCommand()``` constructor is called, it stores the dish name, price and the list of ingredients in an entity called Dish.
- When the ```execute()``` command in ```AddDishCommand``` is called, it calls the ```addDishCommand()``` in ```DishManager``` class that adds the Dish into an arraylist of Dishes.
- It then prints out a message to the console that informs the user that a dish has been added.
Expand Down
86 changes: 75 additions & 11 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ View the deadline list.

Format: `view_deadline`

Note: The price of dishes will be shown in dollars.

#### Delete a deadline:

Format: `delete_deadline n/<name>`
Expand All @@ -80,30 +82,87 @@ Example:
delete_deadline n/need to buy more potatoes
```

### Menu
### Dish

#### Add a recipe to the menu:
#### Add a Dish to the list of dishes:

Successfully adds menu only if the name is unique, otherwise it informs the user to key in a unique menu name
Successfully adds Dish only if all the arguments are correct.

Format: `add_recipe n/<name>`
Format: `add_dish n/<name of dish> pc/<price of dish in cents> [<ingredient 1>;<ingredient 2>;<ingredient 3> ... etc]`

Example:
- Name of dish cannot be blank or start with spaces, it also cannot contain only spaces.
- Price of dish must be an non negative integer value; i.e.: Price cannot be negative, in decimal, etc.
- Ingredient list is encased betwen two square brackets and separated by a semi-colon. The ingredient list can contain any non negative number of items.

Example 1:
```
add_dish n/Chicken Burger pc/1099 [tomatoes;chicken fillet;cheese;bread with sesame seeds]
```
add_recipe n/Chicken rice
Outcome 1:
```
<index_number>. Chicken Burger; $10.99; [tomatoes, chicken fillet, cheese, bread with sesame seeds]
```
You can also omit the ingredient list like such:

#### View the list of recipes:
Example 2:
```
add_dish n/Chicken Burger pc/1099 []
```
Outcome 2:
```
<index_number>. Chicken Burger; $10.99; []
```

#### View the list of dishes added:

It shows the list of dishes currently stored in the program in order.

- The price of dishes are shown in dollars.

Format: `view_recipe`
Format: `view_dish`

#### Delete a recipe from the menu:
#### Delete a dish from the list of dishes:

Format: `delete_recipe n/<name>`
Deletes the dish in the list based on the index given, if a dish exists at that index.

Format: `delete_dish <index_number>`

Example:

Supposed that we have the following list of dishes:
```
1. Chicken Burger; $4.99; [tomatoes, chicken fillet, cheese, bread with sesame seeds]
2. McSpicy Burger; $8.99; [tomatoes, chicken fillet, cheese, bread with sesame seeds]
```
delete_recipe n/Chicken rice
When the `delete_recipe 1` is entered as a command:

Outcome:
```
1. McSpicy Burger; $8.99; [tomatoes, chicken fillet, cheese, bread with sesame seeds]
```
#### Find dishes containing a keyword from the list of dishes

Finds a list of dishes containing a given keyword, if any at all.

Format: `find_dish <keyword>`

- The keyword cannot contain any spaces.
- Only 1 keyword can be entered per find_dish command.

Example:

Supposed we have the following list of dishes:

```
1. McSpicy Burger; $8.99; [tomatoes, chicken fillet, cheese, bread with sesame seeds]
2. Chicken Burger; $10.99; [tomatoes, chicken fillet, cheese, bread with sesame seeds]
```
When `find_dish Chicken` is entered in as a command:

Outcome:

```
2. Chicken Burger; $10.99; [tomatoes, chicken fillet, cheese, bread with sesame seeds]
```

### Workers
Expand Down Expand Up @@ -152,5 +211,10 @@ delete_worker n/Patrick Parker
| view_meetings | view_meetings |
| delete_meeting | delete_meeting n/<name> |
| find_meeting | find_meeting s/<string> |
| add_dish | `add_dish n/<name of dish> pc/<price of dish in cents> [<ingredient 1>;<ingredient 2>;<ingredient 3> ... etc]` |
| view_dish | `view_dish` |
| delete_dish | `delete_dish <index_number>` |
| find_dish | `find_dish <keyword>` |



Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions docs/uml/AddDishCommandSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@startuml
title Add Dish Sequence Diagram

'actor User
participant AddDishCommand
participant Dish
participant DishManager

-> AddDishCommand: AddDishCommand("dish name", price, ["ingredient 1", "ingredient 2", ...])
'AddDishCommand -> AddDishCommand: AddDishCommand("dish name", price, ["ingredient 1", "ingredient 2", ...])
Activate AddDishCommand

-> AddDishCommand: execute("dish name", price, ["ingredient 1", "ingredient 2", ...])
AddDishCommand -> DishManager: execute("dish name", price, ["ingredient 1", "ingredient 2", ...])
'DishManager -> DishManager: DishManager()
Activate DishManager
Dish <- DishManager: create new Dish("dish name", price, ["ingredient 1", "ingredient 2", ...])
Activate Dish
Dish --> DishManager:
AddDishCommand <-- DishManager
<-- AddDishCommand: ui.printMessage("added dish")
@enduml
1 change: 1 addition & 0 deletions src/main/java/commands/menu/FindDishCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

public class FindDishCommand extends Command {

public static final String COMMAND_WORD = "find_dish";
private String stringToFind;
public FindDishCommand(String stringToFind) {
this.stringToFind = stringToFind;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/utils/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Command parseCommand(String userInput) {
return prepareDeleteDishCommand(userInputNoCommand);
case ViewDishCommand.COMMAND_WORD:
return prepareViewDishCommand(userInputNoCommand);
case "find_dish":
case FindDishCommand.COMMAND_WORD:
return prepareFindDishCommand(userInputNoCommand);
default:
return new IncorrectCommand();
Expand Down

0 comments on commit 8844a42

Please sign in to comment.