CoffeeMaker Requirements - version 2.0
Because most computer scientists love their morning (and afternoon) cup of coffee or tea, we’re going to design and implement an online beverage ordering system similar to GrubHub. The requirements for the CoffeeMaker program are described below as use cases, which is a way of modeling requirements from the user’s perspective.
Use cases combine together related scenarios around a key action. They describing the preconditions to reach the use case, the main flow of functionality, extensions to main flow functionality, and alternative or error paths.
After discussing the CoffeeMaker project with others, we had several feature requests! One was the ability to add other types of ingredients beyond coffee, milk, sugar, and chocolate. Customers also want tea, cider, pumpkin spice, and other types of drinks they might get at at coffee shop.
The requirements below are updated to consider the story around “alternative ingredients”. Changed requirements are in red, bold text.
Use Case 1: Display Menu
Display a menu of options for working with the CoffeeMaker systems for a user.
Main Flow
- A user goes to the CoffeeMaker website.
- A user selects one of the following menu options:
Use Case 2: Add Recipe
Preconditions
User selected the Add Recipe option from the menu [UC1]
Main Flow
- A user selects the option to add a recipe.
- The user enters the name and price of the recipe, and the units of each ingredient [Add Ingredient] [Remove Ingredient] [Edit Units] that make up the recipe [Too Many] [Invalid Price] [Invalid Unit] [Duplicate] [No Ingredients].
- The user returns to the main menu [UC1].
Subflows
- [Add Ingredient] A user can select a new ingredient to add to the recipe.
- [Add Ingredient] A user can select two new ingredients to add to the recipe.
- [Remove Ingredient] A user can remove an ingredient in the recipe.
- [Edit Units] A user can provide a unit for the ingredient [Invalid Unit].
Alternative Flows
- [Too Many] If there are already three recipes in the system, then a new recipe may not be added. An error message is printed, and the recipe is not added.
- [Invalid Price] The price must be a positive integer. If the price is not a positive integer then, an error message is printed, and the user is returned to the form to edit. The recipe is not added.
- [Invalid Unit] The units of an ingredient must be positive integers. If the unit value on any of the ingredients is not a positive integer, an error message is printed, and the user is returned to the form to edit. The recipe is not added.
- [Duplicate] If the name of the new recipe already exists in a recipe in the system, an error message is printed, and the user is returned to the form to edit. The recipe is not added.
- [No Ingredients] If the recipe has no ingredients, then an error message is printed, and the user is returned to the form to edit. The recipe is not added.
Use Case 3: Delete Recipe
Preconditions
User selected the Delete Recipe option from the menu [UC1]
Main Flow
- The user will be shown a list of all recipes in the system.
- The user may select one or more recipes that they want to delete.
- The user selects the option to delete the recipes.
- The selected recipes are deleted and a success message is displayed [Cannot Delete].
- The user returns to the main menu [UC1].
Alternative Flows
- [Cannot Delete] If the recipe is deleted by a concurrent user before it’s selected for deletion, an error message is printed and the user is returned to the delete recipe page with an updated list of recipes.
Use Case 4: Edit Recipe
Preconditions
User selected the Edit Recipe option from the menu [UC1]
Main Flow
- The user will be shown a list of all recipes in the system.
- The user may select one recipe that they want to edit [Cannot Edit].
- After selecting a recipe, the form will be pre-filled with all existing values (price and units of all ingredients) for the selected recipe.
- The user edits the price and the ingredients [Add Ingredient] [Remove Ingredient] [Edit Units] that make up the recipe [Cannot Edit] [Invalid Price] [No Ingredients].
- The user returns to the main menu [UC1].
Subflows
- [Add Ingredient] A user can select a new ingredient to add to the recipe.
- [Remove Ingredient] A user can remove an ingredient in the recipe.
- [Edit Units] A user can provide a unit for the ingredient [Invalid Unit].
Alternative Flows
- [Cannot Edit] If the recipe is deleted by a concurrent user before it’s selected for edit, an error message is printed and the user is returned to the edit recipe page with an updated list of recipes.
- [Invalid Price] The price must be a positive integer. If the price is not a positive integer then, an error message is printed, and the user is returned to the form to edit. The recipe is not changed.
- [Invalid Unit] The units of an ingredient must be positive integers. If the unit value on any of the ingredients is not a positive integer, an error message is printed, and the user is returned to the form to edit. The recipe is not changed.
- [No Ingredients] If the recipe has no ingredients, then an error message is printed, and the user is returned to the form to edit. The recipe is not changed.
Use Case 5: Update Inventory
Preconditions
User selected the Update Inventory option from the menu [UC1]
Main Flow
- The user will be shown a listing of the current inventory of ingredients in the CoffeeMaker.
- The user enters the amount of inventory to add for each ingredient [Invalid Unit].
- The current inventory values are updated after inventory is added.
- The user returns to the main menu [UC1].
Alternative Flows
- [Invalid Unit] The units of the ingredients must be positive integers. If the unit value on any of the ingredients is not an integer, an error message is printed, and the user is returned to the form to edit. No inventory is added.
Use Case 6: Order Beverage
Preconditions
User selected the Order Beverage option from the menu [UC1]
Main Flow
- The user will select the beverage they want to purchase.
- The user will enters the amount of money they will use to purchase the beverage.
- The user requests the beverage.
- The system will check if there are enough ingredients in the inventory to make the selected beverage [Insufficient Ingredients].
- The system will check if there is enough money to pay for the beverage [Insufficient Payment] [Invalid Payment].
- If there are enough ingredients and the money paid is sufficient, the ingredients to make the purchased beverage will be removed from the inventory.
- A message indicating that the beverage is ready and the user’s change will be displayed.
- The user may return to the main menu [UC1].
Alternative Flows
- [Insufficient Ingredients] If there is not enough inventory to make the beverage, an error message is printed, the user’s money will be returned, and the user will be returned to the purchase beverage page. No inventory is used.
- [Insufficient Payment] If the user does not enter enough money, an error message is printed, their money will be returned, and the user will be returned to the purchase beverage page. No inventory is used.
- [Invalid Payment] If the payment entered is not numeric or not an integer, an error message is printed, the user’s money will be returned (if the input was numeric), and the user will be returned to the purchase beverage page. No inventory is used.
Use Case 7: Add Ingredients
Preconditions
User selected the Add Ingredients option from the menu [UC1]
Main Flow
1. The user will enters a name for the ingredient.
2. The user will enters the initial amount of ingredient in the system inventory.
3. The user clicks add ingredient [Invalid Unit] [Duplicate].
4. The user may enter another ingredient or return to the main menu [UC1].
Alternative Flows
- [Invalid Unit] The units of the ingredient must be positive integers. If the unit value is not an integer, an error message is printed, and the user is returned to the form to edit. No ingredient or inventory is added.
- [Duplicate] If the name of the new ingredient already exists in the system, an error message is printed, and the user is returned to the form to edit. No ingredient or inventory is added.
