Developer Guide

By: Team T14-4
Since: May 2020

1. Design & Implementation

1.1 Search stock feature

1.1.1 Proposed implementation

In the restaurant daily report, users can search against the stock category by supplying a keyword.

Given below is an example usage scenario and how the search mechanism behaves at each step.

Step 1. The user launches the application for the first time. An empty stock will be initialized.

Step 2. The user executes add stock; i/tomato; q/10; p/0.40; command to add a tomato ingredient into the stock. Further, the user may add more ingredients into the current stock. Suppose the user executes add stock; i/potato; q/5; p/0.40; and add stock; i/rice; q/3; p/0.40; as well.

Step 3. The user can now search against the current stock to see if an ingredient is stored in the stock. The user now executes search stock; k/tomato;, which will display the following result in the image.

Step 4. If the ingredient that the user is searching for does not exist within the stock, a different message will be displayed as shown in the following image.

The following sequence diagram shows how the search operation works:

The sequence diagram can be interpreted as such:

  1. CommandParser calls its own CommandParser#parseCommand(...).
  2. Assuming the user input the search stock command correctly, SearchStockCommand#SearchStockCommand(...) constructor is called.
  3. The newly constructed SearchStockCommand invokes its SearchStockCommand#parseIntoSearchKeyword(...) and does not return anything.
  4. The CommandParser then invokes SearchStockCommand#execute(...), which then further invokes Stock#searchStock(...) from the Stock object.
  5. The Stock object then self-invoke Stock#checkIngredientInStock(...) to see if there are ingredients that matches keyword that was passed into earlier.
  6. If there are search results, Stock#printSearchResult(...) will display all the ingredients that matches the keyword given.
  7. If there is no ingredient that matches the keyword, the program will display a different message to show the user.
  8. Next, the time line returns back to CommandParser and the SearchStockCommand object is destroyed here.
  9. If however, the user input did not input the search stock command correctly, CommandParser will invoke CommandParser#errorCommand() to notify the user.

1.1.2 Design Considerations

Aspect: How search stock executes
Aspect: Data structure to support the search stock feature.

1.2 List stock ingredients in descending quantity

1.2.1 Proposed implementation

In the restaurant daily report, users can view all the ingredients presently in the stock by supplying the input list stock. The ingredients will be ordered in descending quantities, that is, the ingredient that has the highest quantity will be listed first and vice versa.

Given below is an example usage scenario and how the listing mechanism behaves at each step.

Step 1. The user launches the application for the first time. An empty stock will be initialized.

Step 2. The user executes add stock; i/tomato; q/10; p/0.40; command to add a tomato ingredient into the stock. Further, the user may add more ingredients into the current stock. Suppose the user executes add stock; i/potato; q/0; p/0.40; and add stock; i/rice; q/55; p/0.40; as well.

Step 3. The user can now view the current stock to see what ingredients are there in the stock. The user now executes list stock, which will display the following result in the image. In this case, rice has the highest quantity of 55, which is listed first as compared to potato, which has the lowest quantity of 0. This can be seen from the image below.

The listing mechanism process can be summarized in the following sequence diagram below:

The sequence diagram can be interpreted as such:

  1. CommandParser calls its own CommandParser#parseCommand(...).
  2. Assuming the user input the list stock command correctly, ListStockCommand#ListStockCommand() constructor is called.
  3. The time line returns back to CommandParser.
  4. The CommandParser then invokes ListStockCommand#execute(...), which then further invokes Stock#ListStock() from the Stock object.
  5. The Stock object then self-invoke Stock#printStock() to print the ingredients that are in the stock to display it to the user.
  6. Note that within the method Stock#printStock(), the hashMap in the Stock will be sorted in descending ingredient quantity.
  7. If there is no ingredient that in the Stock, the program will display a different message to show the user.
  8. Next, the time line returns back to CommandParser and the ListStockCommand object is destroyed here.
  9. If however, the user input did not input the search stock command correctly, CommandParser will invoke CommandParser#errorCommand() to notify the user.

Alternatively, the following class diagram also explains listing operation works:

  1. When the user first runs the application, the Main object is initialized. The Main object then initializes the ui, the stock object and other objects such as reservations etc. in its Main#start() method.
  2. When the stock object is created, it will create a LoadStock object, which loads all data from the report.txt through LoadStock#loadStockData(...).
  3. Next, moving back to Main, through the Main#runCommandUntilExit() method, it then instructs the ui object to scan and read for user input. A CommandParser object is then initialized to parse this user input into a command.
  4. The CommandParser object detects list stock; as the user input, in which it will then create a ListStockCommand object.
  5. The ListStockCommand object is then executed via its ListStockCommand#execute(...) method, which takes in the stock object initialized previously and instructs it to list all ingredients through its Stock#listIngredient() method.
  6. Within the Stock#listIngredient() method, a temporary List data structure is used to convert from the HashMap in the stock object. The list is then sorted by supplying a new Comparator that compares the ingredient’s quantity. Afterwards, the sorted list is then printed to be displayed to the user.

1.2.2 Design Considerations

Aspect: How listing stock executes
Aspect: Data structure to support the search stock feature.

1.3 Generate profit for the day

1.3.1 Proposed Implementation

In the restaurant daily report, the user can input the amount of items sold each day and a total profit will be generated, when the user inputs profit.

Below is an example usage scenario for the user.

Step 1. The user opens the program and an empty sales is initialized.

Step 2. The user can add sold items by inputting sell dish; d/DISH; q/QUANTITY. An example would be sell dish; d/pasta; q/15;. The user can input as many sales as they like as long as the dish exists in the menu.

Step 3. The user can generate the profit by inputting profit.

The execution can be viewed in the sequence diagram below.

1.3.2 Design Considerations

Aspect: Using a separate class to perform sale commands

Current Implementation: Methods are stored in the sales class

Alternative: Commands are stored in separate classes

1.4 Search reservation

1.4.1. Proposed Implementation

In the restaurant daily report, users can search against the reservation category by supplying either a reservation number or a date.

The feature implements the following operations:

The following class diagram shows the structures relevant to the “search reservation” feature:

Given below is an example usage scenario and how the search mechanism behaves at each step.

Step 1. The user launches the application for the first time. An empty reservations will be initialized.

Step 2. The user executes add reservation; p/Peter; d/2020-03-12 12:00; n/3; c/98955555; command to add a reservation into the reservations list.
Further, the user may add more reservations into the current reservations list.
Suppose the user executes add reservation; p/Mary; d/2020-03-11 12:00; n/8; c/99998888;
and add reservation; p/Lisa; m/no spicy food please; d/2020-03-12 12:00; n/3; c/98889999; as well.

The following object diagram illustrates how the reservations list looks like:

Step 3. The user can now search against the current reservations list to see if an reservation is stored in the reservations list.
If the user executes search reservation; r/1;, the mechanism is shown as follows:

If the user executes search reservation; d/2020-03-12;, the mechanism is shown as follows:

If the user executes search reservation; r/1; d/2020-03-13;, the mechanism is shown as follows:

The following sequence diagram shows how search reservation operation works:

1.4.2 Design Considerations

Aspect: How search reservation executes
Aspect: Data structure to support the search reservation feature.

1.5 Search dish feature

1.5.1 Proposed implementation

In restaurant daily report, a user can search from available menu items using the search dish commmand.

The search dish command takes in a keyword denoted by k/, and searches all dish names for dishes containing the keyword.

An example of the usage of search dish can be found below.

Step 1. User launches application. An empty Menu is initialized.

Step 2. User adds a menu item to the empty menu with add dish; n/bacon pizza; i/cheese, bacon; p/7.00;. Bacon pizza is now on the menu.

Step 3. User adds more menu items to the menu. For example, they can add dish; n/chicken rice; i/chicken, rice; p/4.00; and add dish; n/pasta with bacon; i/pasta, bacon; p/6.00;

Step 4. User searches the menu for any dish names containing a keyword. Let the user execute search dish; k/bacon;, the expected behavior can be found in the screenshot below.

1.5.2 Design Considerations

Aspect: Execution of search dish
Aspect: Data structure in search dish

Appendix A: Product Scope

Target user profile

The Restaurant Daily Report is a CLI application is designed for restaurant owners, who need a simple and efficient way to manage the operation of their business. Ideally, the owner would be proficient at using desktop apps and is a quick typer.

Value proposition

Appendix B: User Stories

Version As a … I want to … So that …
v1.0 restaurant owner add a new ingredient into the stock I can keep track of current ingredient quantities
v1.0 restaurant owner delete an existing ingredient in the stock I can remove ingredients that are no longer used in the kitchen
v1.0 restaurant owner list all existing ingredients in the stock I can view what are the ingredients and their quantities currently
v1.0 restaurant owner add a newly received reservation I can record the details about the reservation and make corresponding preparations
v1.0 restaurant owner mark a reservation as invalid I can update the status of the reservation if the reservation gets canceled
v1.0 restaurant owner list all reservations I can view what reservations the restaurant has currently
v1.0 restaurant owner add dishes I can introduce new dishes to the menu
v1.0 restaurant owner list dishes I can see all the dishes on the menu
v1.0 restaurant owner delete dishes I can remove dishes from the menu
v1.0 restaurant owner add stock I can add stock to the inventory
v1.0 restaurant owner list stock I can see how much stock I currently have
v1.0 restaurant owner delete stock I can remove the stock that has been used or spoiled
v1.0 restaurant owner save the dishes, stock and reservation I have a document that contains all the important details about my restaurant
v2.0 restaurant owner search an ingredient by giving a keyword I can quickly find out the current ingredient’s quantity and price
v2.0 restaurant owner list the reservations in descending quantities I can find out the ingredients that we have the most quickly
v2.0 restaurant owner mark a reservation as served I can update the status of the reservation
v2.0 restaurant owner list all served reservations I can view the achievement of served reservation
v2.0 restaurant owner list all unserved reservations I can know what reservations need to be prepared
v2.0 restaurant owner search a reservation via reservation number I can know the details about a specific reservation
v2.0 restaurant owner search a reservation via a specific date I can know the achievement on a certain date or know what reservations I need to prepare on a certain date
v2.0 restaurant owner search dishes I can know which dishes contain a certain word and the ingredients of those dishes
v2.0 restaurant owner search stock I can know the quantity and cost of specific ingredients
v2.1 restaurant owner clear the reservations list I can have an empty reservations list when situations, like moving restaurant to a new place, happen
v2.1 restaurant owner load the dishes, stock and reservation I don’t have to re-enter the dishes, stock and reservations when I start up the program
v2.1 restaurant owner clear the ingredients in the stock I can reset the entire stock if there are too many unwanted ingredients stored in the program
v2.1 restaurant owner load the stock data from a data file I can port the data from one computer to another
v2.1 restaurant owner search a reservation without being tied to case sensitivity I know all the possible ingredients if I typed in a keyword

Appendix C: Non-Functional Requirements

Appendix D: Glossary

Appendix E: Instructions for Manual Testing

Given below are instructions to test the program manually.

E.1. Launch and Shutdown

  1. Download the jar file and copy into an empty folder.
  2. Open a Terminal in that folder.
  3. Run the command java -jar [CS2113-T14-4][RestaurantDailyReport].jar. The CLI should appear in a few seconds. It should be a welcome page.

E.2. Add Functionality

E.2.1 Adding a dish into menu

Adding a dish into menu.

E.2.2. Adding an ingredient into stock

Adding an ingredient into stock.

E.2.3. Adding a reservation

Adding a reservation into an empty list.

E.3. Delete functionality

E.3.1 Deleting a dish in the menu

Deleting a dish in the menu.

E.3.2. Delete an ingredient in the stock

Deleting an ingredient in the stock.

E.3.3 Deleting a reservation

Deleting a Reservation while all reservations are listed.

E.3.4 Marking a reservation

Marking a reservation as Served while all reservations are listed.

E.4. Search functionality

E.4.1 Search a dish

Searching a dish in the menu.

E.4.2 Search an ingredient

Searching an ingredient in the menu.

E.4.3 Search a reservation

Searching a reservation while all reservations are listed.

E.5 List functionality

E.5.1 List all dishes in the menu

Listing all dishes in the menu.

E.5.2 List all ingredients in the stock

Listing all ingredients in the stock.

E.5.3 List all reservations

Listing all reservations at the beginning of the program execution with reservation content already exist in the “report.txt” file.

E.5.4. List all Served reservations

Listing all served reservations while all reservations are listed.

E.5.5. List all Unserved reservations

Listing all unserved reservations while all reservations are listed.

E.6 Clear functionality

E.6.1 Clear all ingredients

Clear all ingredients in the stock.

E.6.2 Clear all reservations

Clear all reservations in the list while all reservations are listed.

E.7 Sales Functionality

E.7.1 Add a sales

Adding sold dishes

E.7.2 Calculating Profit