1 / 19

Vending Machine Modeling

Vending Machine Modeling. 2003 Fall Software Design (CSED332) Oct. 30 th , 2003. Agenda. Domain Model Use Case Collaboration Diagram Design Class Diagram Message Sequence Diagram. ItemManagement. TransactionManagement. SelectionButton. total. quantity. ItemLight. ItemDispenser.

zilya
Download Presentation

Vending Machine Modeling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Vending Machine Modeling 2003 Fall Software Design (CSED332) Oct. 30th, 2003

  2. Agenda • Domain Model • Use Case • Collaboration Diagram • Design Class Diagram • Message Sequence Diagram

  3. ItemManagement TransactionManagement SelectionButton total quantity ItemLight ItemDispenser Owner Customer ReturnButton ItemSpec price MoneyCounter MoneyDispenser c50_Count c100_Count c500_Count bill_Count CoinReceiver BillReceiver MoneyDisplay Vending Machine Domain Model Domain Model modify 1 1..* 1 1 1 describes-item request- dispense add or remove item 1 1 1 1..* push notify- selection turn-on or -off 1..* 1 1 1 1 add or remove money 1..* Inform-deduction Inform-total 1 push 1 1 display-total-of 1 notify- change- request 1 1 * * 1 request- change- dispense add-money query-if-changeable 1 * * 1 Insert coin deposit-money-to 1 1 1 Request- dispense deposit-money-to Insert bill 1 1 1 1 1

  4. Vending Machine Use Cases (1) Use Case • Actors and their goal • Owner • to fill items • to fill money • to change item (info.) • Customer • - to buy one or more drinks • Corresponding Use Cases • Fill Items • Fill Money • Change Items • Customer • - Buy Items

  5. Vending Machine Use Cases (2) Use Case • Use Case: Buy Items • Primary Actor: Customer • Stakeholders: • Tax Collector - interested in collecting correct sales tax • Precondition: Vending Machine (VM) turned on, not in manager mode, • and the numbers of each item contained in VM • greater than zero. • Post-condition: Customer gets one or more items and exact change. • Main Success Scenario • *1. Customer deposits money. • *2. Customer selects an item. • *3. Customer gets change. • At any time, 1~3 can be repeated in arbitrary order.

  6. Vending Machine Use Cases (3) Use Case • Use Case: Deposit Money • Primary Actor: Customer • Precondition: Vending machine turned on, not in manager mode • Post-condition: Total amount of money updated • and item lights for selectable items are turned on. • Main Success Scenario • 1. Customer inserts a coin or bill. • 2. Vending Machine (VM) updates display with the total amount • deposited. • 3. VM turns on item lights for selectable items. • Extensions • 1a. If an irregular coin or bill is inserted, the VM rejects it.

  7. Vending Machine Use Cases (4) Use Case • Use Case: Select an Item • Primary Actor: Customer • Precondition: Vending machine turned on, not in manager mode, • and selectable items lighted • Post-condition: Customer gets a selected item if s/he choose • selectable one and the total amount of money is • deducted by the price of the dispensed item. • Main Success Scenario • 1. Customer pushes a selection button. • 2. If the item corresponds to the pushed button is selectable, • VM dispenses the item and deduct total amount of money by • the price of the item. • 3. VM turns on item lights for selectable items • and turns off item lights for not selectable items.

  8. Vending Machine Use Cases (5) Use Case • Use Case: Get Change • Primary Actor: Customer • Precondition: Vending machine turned on, not in manager mode • Post-condition: User gets exact change. • Total amount of money is updated to zero. • Main Success Scenario • 1. Customer push the button to get the change. • 2. VM updates money display to zero. • 3. VM turns off all item lights. • 4. VM returns change.

  9. Vending Machine Use Cases (6) Use Case • Use Case: Fill Items • Primary Actor: Owner • Precondition: Vending machine turned on, not in use by the user • Post-condition: Item refilled and item number updated • Main Success Scenario • 1. Owner opens the cover. • 2. Owner fills items. • 3. VM counts and updates item numbers. • 4. Owner closes the cover.

  10. Vending Machine Use Cases (7) Use Case • Use Case: Fill Money • Primary Actor: Owner • Precondition: Vending machine turned on and not in use by the user • Post-condition: Money refilled and the amount is updated • Main Success Scenario • 1. Owner opens the cover. • 2. Owner fills coins and bills into money holders. • 3. VM counts and updates money amount. • 4. Owner closes the cover.

  11. Vending Machine Use Cases (8) Use Case • Use Case: Change Items • Primary Actor: Owner • Precondition: Vending machine turned on, not in use by the user • Post-condition: Item price information changed • Main Success Scenario • 1. Owner opens the cover. • 2. Owner sets new price for items. • 3. Owner closes the cover.

  12. Vending Machine SSD (1) System Sequence Diagram :Customer :System SSD1 – deposit money inserts money( coin or bill ) Money display is updated. Item lights for selectable items are turned on. :Customer :System SSD2 – select an item selects an item selected item dispensed Money display is updated. Item lights for selectable items are turned on. :Customer :System SSD3 – get change request change Money display is reset to zero. All item lights are turned off. change returned

  13. Vending Machine SSD (2) System Sequence Diagram :Owner :System SSD4 – fill items open cover fill items close cover :Owner :System SSD5 – fill money open cover fill money close cover :Owner :System SSD6 – change items open cover modify item price close cover

  14. getPrice() setPrice( price ) ItemManagement TransactionManagement total: Integer quantity: Integer SelectionButton totalChanged( total ) setQuantity( num ) processSelection() ItemLight MoneyDispenser ItemDispenser turnOn() turnOff() ReturnButton dispense( count ) dispense() ItemSpec price: Integer PriceInputDevice ItemRefillSensor MoneyRefillSensor addMoney( amount) deduct( amount ) getTotal() returnChange() CoinReceiver BillReceiver MoneyCounter c50_Count: Integer c100_Count: Integer c500_Count: Integer bill_Count: Integer isChangeable( amount ): Boolean deposit( amount ) setMoney( type, count ) returnChange( amount ) Design Class Diagram of VM Design Class Diagram setPrice 1 1..* 1 getPrice 1 1 1 dispense processSelection 1 1 turn-on turn-off 1 1 setQuantity 1 1 1..* totalChanged deduct, getTotal 1 isChangeable MoneyDisplay 1 returnChange display 1 1 1 display(num) 1 returnChange addMoney 1 deposit 1 1 deposit dispense 1 1 1 1..* setMoney 1..* 1

  15. Message Sequence Diagram Deposit Money

  16. Message Sequence Diagram Select an Item

  17. Message Sequence Diagram Get Change

  18. Message Sequence Diagram Others MSD for Fill Items MSD for Fill Money MSD for Change Items

  19. References • Craig Larman, Applying UML and Patterns 2nd Ed., 2001, PHPTR

More Related