CoffeeMaker Example


North Carolina State University
CSC 326 - Software Engineering
Laurie Williams, Dright Ho, Sarah Smith

Back to Software Engineering Tutorials


The Computer Science department at NCSU is in the process of building a new CSC building on Centennial Campus. We all know that computer scientists love caffene, so the CSC department is planning on installing a CoffeeMaker in a lounge across the hall from the 24-hour computer lab. Our job is to test and model the functionality of the CoffeeMaker. We are only working with the logic code behind the hardware, so only a command line interface is used. Here is a partial listing of requirements for the CoffeeMaker system. Use this as a reference when completing the CSC 326 tutorials.

CoffeeMaker Project updated for CS3365 TTU.

Requirements - User Stories

Title: Waiting State
AccTest: checkOptions0 Priority: 1 Story Points: 2
When the Coffee Maker is not in use it waits for user input. There are six different options of user input: 1) add recipe, 2) delete a recipe, 3) edit a recipe, 4) add inventory, 5) check inventory, and 6) purchase beverage.

Title: Add a Recipe
AccTest: addRecipe1 Priority: 1 Story Points: 2
Only three recipes may be added to the CoffeeMaker. A recipe consists of a name, price, units of coffee, units of milk, units of sugar, and units of chocolate. Each recipe name must be unique in the recipe list. Price must be handled as an integer. An status message is printed. Upon completion, the Coffee Maker is returned to the waiting state.

Title: Delete a Recipe
AccTest: deleteRecipe1 Priority: 2 Story Points: 1
A recipe may be deleted from the CoffeeMaker if it exists in the list of recipes in the CoffeeMaker. The recipe to be deleted is chosen by its name. Upon completion, a status message is printed and the Coffee Maker is returned to the waiting state.

Title: Edit a Recipe
AccTest: editRecipe1 Priority: 2 Story Points: 1
A recipe may be edited in the CoffeeMaker. The user will be prompted for the name of which recipe they wish to edit if there are any recipes to edit, then they will be asked to reenter the recipe information. A recipe name may not be changed to a name of any other recipe in the recipe list. Upon completion, a status message is printed and the Coffee Maker is returned to the waiting state.

Title: Add Inventory
AccTest: addInventory1 Priority: 1 Story Points: 2
Inventory may be added to the machine at any time. The types of inventory in the Coffee Maker are coffee, milk, sugar, and chocolate. The inventory is measured in integer units. No inventory may be taken away from the CoffeeMaker except by purchasing a beverage. Upon completion, a status message is printed and the Coffee Maker is returned to the waiting state.

Title: Check Inventory
AccTest: checkInventory Priority: 2 Story Points: 1
Inventory may be checked at any time. The units of each item in the inventory are displayed. Upon completion, the Coffee Maker is returned to the waiting state.

Title: Purchase Beverage
AccTest: purchaseBeverage1 Priority: 1 Story Points: 2
The user will not be able to purchase a beverage if they do not deposit enough money into the CoffeeMaker. Change will be dispensed to the user, if they paid more than the price of the beverage. A user's money will be returned if there is not enough inventory to make the beverage. Upon completion, the Coffee Maker is returned to the waiting state.

Requirements - Use Cases

UC1: Flow of Events for the Waiting State Use Case
1.1 Preconditions: None
1.2 Main Flow: The Coffee Maker waits for user input. There are six options to chose from [E1]: 1) add recipe [UC2], 2) delete a recipe [UC3], 3) edit a recipe [UC4], 4) add inventory [UC5], 5) check inventory [UC6], and 6) purchase beverage [UC7].

UC2: Flow of Events for the Add Recipe Use Case
2.1 Preconditions: None
2.2 Main Flow: A user selects that they want to add a recipe. The user enters the name, price [E2][E3][E4], units coffee [E2][E3][E4], units sugar [E2][E3][E4], units milk [E2][E3][E4], and units chocolate [E2][E3][E4] that make up the recipe. [E1][E5]
2.3 Subflows: None
2.4 Alternative Flows:
[E1] If there are already three recipes in the system, then a new recipe may not be added. The user is returned to the main menu.
[E2] The price must be a integer. If the price is not a number then, a status message is printed, and the user is returned to the main menu.
[E3] The units of coffee, sugar, milk, and chocolate must be integers. If the unit value on any of the ingredients is not an integer, a status message is printed, and the user is returned to the main menu.
[E4] The price and units of ingredients must be positive. If any number is negative, a status message is printed, and the user is returned to the main menu.
[E5] If the name of the new recipe already exists in a recipe in the system, the new recipe will not be added.

UC3: Flow of Events for the Delete Recipe Use Case
3.1 Preconditions: None
3.2 Main Flow: The user will be shown a list of all recipes in the system, and asked to choose the recipe, by number, that they wish to delete. [S1][E1][E2]
3.3 Subflows:
[S1] If the user selects an empty recipe to delete, the user is returned to the main menu.
3.4 Alternative Flows:
[E1] If the user selects a number that is out of bounds of the number of recipes, the user is returned to the main menu.
[E2] If the user enters a alphabetic character, the user is returned to the main menu.

UC4: Flow of Events for the Edit Recipe Use Case
4.1 Preconditions: None
4.2 Main Flow: The user will be shown a list of all recipes in the system, and asked to choose the recipe, by number, that they wish to edit. [S1][E1][E2] The user enters the name, price [E3][E4][E5], units coffee [E3][E4][E5], units sugar [E3][E4][E5], units milk [E3][E4][E5], and units chocolate [E3][E4][E5] that make up the recipe. [E6][E7]
4.3 Subflows:
[S1] If the user selects an empty recipe to edit, the user is returned to the main menu.
4.4 Alternative Flows:
[E1] If the user selects a number that is out of bounds of the number of recipes, the user is returned to the main menu.
[E2] If the user enters a alphabetic character, the user is returned to the main menu.
[E3] The price must be a integer. If the price is not a number then, a status message is printed, and the user is returned to the main menu.
[E4] The units of coffee, sugar, milk, and chocolate must be integers. If the unit value on any of the ingredients is not an integer, a status message is printed, and the user is returned to the main menu.
[E5] The price and units of ingredients must be positive. If any number is negative, a status message is printed, and the user is returned to the main menu.
[E6] If the name of the new recipe already exists in a recipe in the system, the new recipe will not be added.
[E7] If there are already three recipes in the system, then a new recipe may not be added. The user is returned to the main menu.

UC5: Flow of Events for the Add Inventory Use Case
5.1 Preconditions: None
5.2 Main Flow: The user will be prompted for the units of each of the four ingredients they wish to add to the inventory. [E1][E2]
5.3 Subflows: None
5.4 Alternative Flows:
[E1] If the user selects a number that is negative or a non-Integer, the user will be reprompted for the amount.
[E2] If the user enters a alphabetic character, the user will be reprompted for the amount.

UC6: Flow of Events for the Check Inventory Use Case
6.1 Preconditions: None
6.2 Main Flow: The user will be shown a listing of the inventory of ingredients in the CoffeeMaker
6.3 Subflows: None
6.4 Alternative Flows: None

UC7: Flow of Events for the Purchase Beverage Use Case
7.1 Preconditions: None
7.2 Main Flow: The user will select the beverage they wish to purchase [S1]. The user will deposit money to pay for the beverage [S2].
7.3 Subflows:
[S1] The CoffeeMaker will check if there are enough ingrediant inthe inventory to make the selected drink. [E1] The price of the beverage will be displayed.
[S2] The CoffeeMaker will make sure enough money was deposited [E2], any extra change will be returned.
7.4 Alternative Flows:
[E1] If there is not enough inventory to make the beverage, a message will be displayed, and the user will be returned to the main menu.
[E2] If the user does not enter enough money, they will be prompted for more money or given the option to return to the main menu and have their money returned.


Requirements Design Test
User Stories
Use Cases
Use Case Diagram

Class Diagram
Sequence Diagram
State Chart Diagram

Acceptance Tests
FIT Tests
JUnit tests are in unittests/ folder of CoffeeMaker project

Back to Software Engineering Tutorials
CoffeeMaker Example for CSC 326 Tutorials ©2003-2006 North Carolina State University, Laurie Williams, Dright Ho, Sarah Smith
Email Sarah Smith with any questions or comments about this example.
Last Updated: Thursday, March 9, 2006 1:59 PM