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:

Contract CO4: makePayment

Operation:makePayment( amount: Money )
Cross References:

Use Cases: Process Sale

Preconditions:There is an underway sale.
Postconditions:

- 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 ...

Get Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.