CoffeeMaker Example
CoffeeMaker Example
CoffeeMaker Example
CoffeeMakerExample
LaurieWilliams,DrightHo,andSarahHeckman[ContactAuthors]
NorthCarolinaStateUniversity
CSC326SoftwareEngineering
BacktoSoftwareEngineeringTutorials
TheComputerSciencedepartmentatNCSUhasanewbuildingonCentennialCampus.Weallknowthatcomputerscientistslovecaffeine,
sotheCSCdepartmentisplanningoninstallingaCoffeeMakerinaloungeacrossthehallfromthe24hourcomputerlab.Ourjobistotest
andmodelthefunctionalityoftheCoffeeMaker.Weareonlyworkingwiththelogiccodebehindthehardware,soonlyacommandline
interfaceisusedformanualtesting.HereisapartiallistingofrequirementsfortheCoffeeMakersystem.Usethisasareferencewhen
completingtheCSC326tutorials.
RequirementsUserStories
Title:WaitingState
WhentheCoffeeMakerisnotinuseitwaitsforuserinput.Therearesixdifferentoptions
ofuserinput:1)addrecipe,2)deletearecipe,3)editarecipe,4)addinventory,5)check
inventory,and6)purchasebeverage.
Title:AddaRecipe
OnlythreerecipesmaybeaddedtotheCoffeeMaker.Arecipeconsistsofaname,price,
unitsofcoffee,unitsofmilk,unitsofsugar,andunitsofchocolate.Eachrecipenamemust
beuniqueintherecipelist.Pricemustbehandledasaninteger.Astatusmessageis
printedtospecifyiftherecipewassuccessfullyaddedornot.Uponcompletion,the
CoffeeMakerisreturnedtothewaitingstate.
Title:DeleteaRecipe
ArecipemaybedeletedfromtheCoffeeMakerifitexistsinthelistofrecipesinthe
CoffeeMaker.Therecipesarelistedbytheirname.Uponcompletion,astatusmessageis
printedandtheCoffeeMakerisreturnedtothewaitingstate.
Title:EditaRecipe
ArecipemaybeeditedintheCoffeeMakerifitexistsinthelistofrecipesinthe
CoffeeMaker.Therecipesarelistedbytheirname.Afterselectingarecipetoedit,theuser
willthenenterthenewrecipeinformation.Arecipenamemaynotbechanged.Upon
completion,astatusmessageisprintedandtheCoffeeMakerisreturnedtothewaiting
state.
Title:AddInventory
Inventorymaybeaddedtothemachineatanytimefromthemainmenu,andisaddedto
thecurrentinventoryintheCoffeeMaker.ThetypesofinventoryintheCoffeeMakerare
coffee,milk,sugar,andchocolate.Theinventoryismeasuredinintegerunits.Inventory
mayonlyberemovedfromtheCoffeeMakerbypurchasingabeverage.Uponcompletion,
astatusmessageisprintedandtheCoffeeMakerisreturnedtothewaitingstate.
Title:CheckInventory
http://agile.csc.ncsu.edu/SEMaterials/tutorials/coffee_maker/#user_stories 1/3
9/4/2016 CoffeeMakerExample
Inventorymaybecheckedatanytimefromthemainmenu.Theunitsofeachiteminthe
inventoryaredisplayed.Uponcompletion,theCoffeeMakerisreturnedtothewaiting
state.
Title:PurchaseBeverage
Theuserselectsabeverageandinsertsanamountofmoney.Themoneymustbean
integer.IfthebeverageisintheRecipeBookandtheuserpaidenoughmoneythe
beveragewillbedispensedandanychangewillbereturned.Theuserwillnotbeableto
purchaseabeverageiftheydonotdepositenoughmoneyintotheCoffeeMaker.Auser's
moneywillbereturnedifthereisnotenoughinventorytomakethebeverage.Upon
completion,theCoffeeMakerdisplaysamessageaboutthepurchasestatusandis
returnedtothemainmenu.
RequirementsUseCases
UC1:FlowofEventsfortheWaitingStateUseCase
1.1Preconditions:None
1.2MainFlow:TheCoffeeMakerwaitsforuserinput.Therearesixoptionstochosefrom[E1]:1)addrecipe[UC2],2)deletearecipe[UC3],
3)editarecipe[UC4],4)addinventory[UC5],5)checkinventory[UC6],and6)purchasebeverage[UC7].
UC2:FlowofEventsfortheAddRecipeUseCase
2.1Preconditions:None
2.2MainFlow:Auserselectsthemenuoptiontoaddarecipe.Theuserentersthename,price[E2][E3][E4],unitscoffee[E2][E3][E4],units
sugar[E2][E3][E4],unitsmilk[E2][E3][E4],andunitschocolate[E2][E3][E4]thatmakeuptherecipe.[E1][E5]
2.3Subflows:None
2.4AlternativeFlows:
[E1]Iftherearealreadythreerecipesinthesystem,thenanewrecipemaynotbeadded.Theuserisreturnedtothemainmenu.
[E2]Thepricemustbeainteger.Ifthepriceisnotanintegerthen,astatusmessageisprinted,andtheuserisreturnedtothemainmenu.
[E3]Theunitsofcoffee,sugar,milk,andchocolatemustbeintegers.Iftheunitvalueonanyoftheingredientsisnotaninteger,astatus
messageisprinted,andtheuserisreturnedtothemainmenu.
[E4]Thepriceandunitsofingredientsmustbepositive.Ifanynumberisnegative,astatusmessageisprinted,andtheuserisreturnedto
themainmenu.
[E5]Ifthenameofthenewrecipealreadyexistsinarecipeinthesystem,thenewrecipewillnotbeadded.
http://agile.csc.ncsu.edu/SEMaterials/tutorials/coffee_maker/#user_stories 2/3
9/4/2016 CoffeeMakerExample
UC3:FlowofEventsfortheDeleteRecipeUseCase
3.1Preconditions:None
3.2MainFlow:Theuserwillbeshownalistofallrecipesinthesystem,andaskedtochoosetherecipe,bynumber,thattheywishtodelete.
[S1][E1][E2][E3]
3.3Subflows:
[S1]Amessageisprinteddescribingthesuccessfuldeletionoftheselectedrecipe.
3.4AlternativeFlows:
[E1]Iftheuserselectsanumberthatisoutofboundsofthenumberofrecipes,theuserisreturnedtothemainmenu.
[E2]Iftheuserentersaalphabeticcharacter,theuserisreturnedtothemainmenu.
[E3]Iftheuserselectsanemptyrecipetodelete,theuserisreturnedtothemainmenu.
UC4:FlowofEventsfortheEditRecipeUseCase
4.1Preconditions:None
4.2MainFlow:Theuserwillbeshownalistofallrecipesinthesystem,andaskedtochoosetherecipe,bynumber,thattheywishtoedit.
[E1][E2]Theuserenterstheprice[E3][E4][E5],unitscoffee[E3][E4][E5],unitssugar[E3][E4][E5],unitsmilk[E3][E4][E5],andunitschocolate
[E3][E4][E5]thatmakeupthemodifiedselectedrecipe.[E6]
4.3Subflows:None
4.4AlternativeFlows:
[E1]Iftheuserselectsanumberthatisoutofboundsofthenumberofrecipes,theuserisreturnedtothemainmenu.
[E2]Iftheuserentersaalphabeticcharacter,theuserisreturnedtothemainmenu.
[E3]Thepricemustbeainteger.Ifthepriceisnotanumberthen,astatusmessageisprinted,andtheuserisreturnedtothemainmenu.
[E4]Theunitsofcoffee,sugar,milk,andchocolatemustbeintegers.Iftheunitvalueonanyoftheingredientsisnotaninteger,astatus
messageisprinted,andtheuserisreturnedtothemainmenu.
[E5]Thepriceandunitsofingredientsmustbepositive.Ifanynumberisnegative,astatusmessageisprinted,andtheuserisreturnedto
themainmenu.
[E6]Iftheuserselectsanemptyrecipetoedit,theuserisreturnedtothemainmenu.
UC5:FlowofEventsfortheAddInventoryUseCase
5.1Preconditions:None
5.2MainFlow:Theuserwillbepromptedfortheunitsofeachofthefouringredientstheywishtoaddtotheinventory.[E1][E2]
5.3Subflows:None
5.4AlternativeFlows:
[E1]IftheuserselectsanumberthatisnegativeoranonInteger,theuserwillberepromptedfortheamount.
[E2]Iftheuserentersaalphabeticcharacter,theuserwillberepromptedfortheamount.
UC6:FlowofEventsfortheCheckInventoryUseCase
6.1Preconditions:None
6.2MainFlow:TheuserwillbeshownalistingoftheinventoryofingredientsintheCoffeeMaker
6.3Subflows:None
6.4AlternativeFlows:None
UC7:FlowofEventsforthePurchaseBeverageUseCase
7.1Preconditions:None
7.2MainFlow:Theuserwillselectthebeveragetheywishtopurchase.Theuserwilldepositmoneytopayforthebeverage.[S1][S2]
7.3Subflows:
[S1]TheCoffeeMakerwillcheckifthereareenoughingredientsintheinventorytomaketheselecteddrink.[E1]
[S2]TheCoffeeMakerwillmakesureenoughmoneywasdeposited[E2],thebeveragewillbedispensed,andanyextrachangewillbe
returned.
7.4AlternativeFlows:
[E1]Ifthereisnotenoughinventorytomakethebeverage,amessagewillbedisplayed,theuser'smoneywillbereturned,andtheuserwill
bereturnedtothemainmenu.
[E2]Iftheuserdoesnotenterenoughmoney,theirmoneywillbereturned,andtheuserwillbereturnedtothemainmenu.
BacktoSoftwareEngineeringTutorials
CoffeeMakerExampleforCSC326Tutorials20032008NorthCarolinaStateUniversity,LaurieWilliams,DrightHo,SarahHeckman
Emailtheauthorswithanyquestionsorcommentsaboutthisexample.
LastUpdated:Monday,March30,20093:34PM
http://agile.csc.ncsu.edu/SEMaterials/tutorials/coffee_maker/#user_stories 3/3