UML Sequence Diagrams
13. Contracts for Some Operations in POST system
Tables 3.12 and 3.13 show examples contracts for “enterItem” operation and “makePayment” operation of the POST system.
Table 3.12: Contract for enterItem Operation Contract
Name | enterItem(upc:UPC, quantity:Integer): |
Responsibilities: | Enter (or record) sale of an item and add it to the sale. Display the item description and price. |
Type: | System |
Cross References: | System Functions: R1.1, R1.3, R1.9 Use Cases, Buy Items: |
Note: | Use superfast database access. |
Exceptions: | If the UPC is not valid, indicate that it was an error. |
Output: | |
Pre-conditions: | UPC is known to the system. |
Table 3.13: Contract for makePayment Operation
Name | makePayment(amount: Quantity). |
Responsibilities: | Record the payment, calculate balance and print receipt |
Type: | System |
Cross References: | System Functions: R2.1 Use Cases: Buy Items |
Note: | Use superfast database access
|
Output: | |
Pre-conditions: | |
Post-conditions: | 1. A Payment was created (instance creation). 2. Payment.amountTendered was set to amount (attribute medication). 3. The Payment was associated with the Sale (association formed) 4. The Sale was associated with the Store, to add it to the historical log of completed sales (association formed). |