160 likes | 251 Views
1. Service Representatives. Customers. 1-*. 1-*. service the. buy items from the. 1. 1. Mark I Vending Machine (MIVM) System {application}. 4. The model layer contains 2 packages: Role package Dispenser package. CLIENT INTERFACE LAYER. handles and interprets
E N D
1 Service Representatives Customers 1-* 1-* service the buy items from the 1 1 Mark I Vending Machine (MIVM) System {application}
4 • The model layer contains • 2 packages: • Role package • Dispenser package CLIENT INTERFACE LAYER handles and interprets custom operating system interrupts for the COORDINATION LAYER coordinates and forwards appropriate inputs to the MODEL LAYER reuses application-independent classes from the controls output devices and displays non-mode information via the displays mode information via the SERVER INTERFACE LAYER reuses application- independent classes from the reuses application-information classes from the reuses application-independent classes from the FOUNDATION LAYER
5 10 10 10 number- Selection- Buttons 8 letter- Selection- Buttons CUSTOM OPERATING SYSTEM customOperatingSystemInterrupts event (aString); CLIENT INTERFACE PACKAGE tripped (); door- Switch pressed (); pressed (); pressed (); inserted (aBill); inserted (aCoin); pressed (); locked (); refund- Button bill- Validator coin- Validator gate mode- Button valid (aCoin); selected (aLetter); changeMode (); valid (aBill); refund (); selected (anInteger); currentModeProxy doorLocked (); COORDINATION PACKAGE
6 10 10 10 number- Selection- Buttons 8 letter- Selection- Buttons CLIENT INTERFACE PACKAGE bill- Validator coin- Validator door mode- Button refund- Button currentModeProxy valid (aCoin); selected (aLetter); changeMode (); doorLocked (); selected (anInteger); refund (); valid (aBill); COORDINATION PACKAGE displayMessages (); refund (); reset (); selected (anInteger); selected (aLetter); valid (aMoney); refund (); reset (); selected (anInteger); selected (aLetter); valid (aMoney) throws UnexpectedMoneyException; refund (); reset (); selected (anInteger); selected (aLetter); valid (aMoney) throws UnexpectedMoneyException; dispenseItemMode displayHistoryMode setPriceMode serviceRepresentative display (currentMode); displayMessages (); refund (); reset () throws CouldNotResetException; selected (anInteger); selected (aLetter); valid (aMoney); displayTotalIncome (); displayTotalItemsSold (); reset (); selected (anInteger); selected (aLetter); coinDispenserAssemblyLoaded (); main- Display customer SERVER INTERFACE PACKAGE ROLE PACKAGE
serviceRepresentative 8 10 10 3 coin- Dispensers 80 items- Dispensers customer- Messages ROLE PACKAGE service- Representative- Selection customer- Credit customer- Selection getTotalIncome (); getTotalItemsSold (); isWarningNeeded (); coinDispenserAssembly itemDispenserAssembly dispense (aMoney) throws CouldNotDispense- AllException; inserted (aCoin); loaded (); priceAt (aLocation) throws InvalidSelectionException; priceAt (aLocation,aMoney) throws InvalidSelectionException; dispenseAt (aLocation) throws InvalidSelectionException; priceAt (aLocation) throws InvalidSelectionException; isPractical (aPrice); DISPENSER PACKAGE dispense (aMoney) throws CouldNotDispenseAllException; isPractical (aPrice); coinDispensingPolicy dispense () throws InvalidSelectionException; price () throws InvalidSelectionException; price (aMoney) throws InvalidSelectionException; coinType (); haveCoin (); coinInserted (); next (); coinType (); dispense () throws CouldNotDispenseException; itemStepperMode coinSolenoid step (360) throws NoMotorException; display (aLocation,aPrice) throws NoItemDisplayException; push () throws NoCoinException; itemDisplay SERVER INTERFACE PACKAGE
currentModeProxy 9 10 10 80 item- Dispensers 3 coin- Dispensers serviceRepresentative COORDINATION PACKAGE customer ROLE PACKAGE DISPENSER PACKAGE service- Representative- Selection customer- Messages customer- Selection customOperatingSystemCalls itemStepperMotor display (aString); push () throws NoCoinException; step (360) throws NoMotorException; display (aLocation,aPrice) throws NoItemDisplayException; itemDisplay mainDisplay coinSolenoid dispenseCoinFrom (aPort) throws FailedException; dispenseItemFrom (aPort) throws FailedException; itemDisplay (aString,aPort) throws FailedException; mainDisplay (aString); SERVER INTERFACE PACKAGE
11 Precondition: The mode is “DispenseItem”. Postcondition: The mode is “DispenseItem”. Customer Makes a Payment. MIVM Software A: Concurrently Customer Inserts a Valid Bill A: and Customer Inserts a Valid Coin A: end concurrently.
12 custom- OperatingSystem Interrupts custom- Operating- SystemCalls Precondition: currentMode = dispenseItemMode Customer Inserts a Valid Bill. bill- Validator current- ModeProxy dispense- ItemMode customer customer- Credit customer- Selection main- Display inserted (aBill); valid (aBill); valid (aBill); valid (aBill); add (aBill); creditIncremented (); A: If itemSelected Attempt to Dispense A: else display (); display (amount); displayMain (amount); A: end if.
coin- Dispenser- Assembly coin- Dispensing- Policy 13 Dispense Changes. customer- Credit dispense (credit); dispense (credit); A: If credit >= Money.none () Dispense Quarters A: end if. B: If credit >= Money.none () Dispense Dimes B: end if. C: If credit >= Money.none () Dispense Nickels C: end if. Display Greeting
coin- Dispensing- Policy customOperating- SystemCalls aCoinDispenser aCoinSolenoid coin- Dispensers 14 canDispense = true; amountToDispense = credit.amount (); Dispense Quarters. amountToDispense = amountToDispense - Coin.quarter (); A: For each coin dispenser in coinDispensers while the amount to dispense is not less than a quarter, loop next (); coinType (); B: If coinType () = Coin.quarter (), then C: While amount to dispense is not less than a quarter and can dispense, loop dispense (); dispenseCoinFrom (aPort); push (); D: If a quarter was dispensed, then FailedException! D: else NoCoinException! CouldNotDispenseException! D: end if. C: end loop. B: end if. A: end loop.