O'Reilly logo

Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition by Craig Larman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required