17.7. Object Design: makePayment
The makePayment system operation occurs when a cashier enters the amount of cash tendered for payment. Here is the complete contract:
|Operation:||makePayment( amount: Money )|
|Preconditions:||There is an underway sale.|
- A Payment instance p was created (instance creation).
- p.amountTendered became amount (attribute modification).
- p was associated with the current Sale (association formed).
- The current Sale was associated with the Store (association formed); (to add it to the historical log of completed sales).
A design will be constructed to satisfy the postconditions of makePayment.
Creating the Payment
One of the contract postconditions ...