UML&OCL Modeling Languages


Exercises

Subject 2

Consider the following UML class diagram:

Using OCL, answer the following questions:

a. Write an OCL expression to retrieve all Orders that have a total greater than 100.
b. Write an OCL expression to retrieve all Items that have a price less than 10.
c. Write an OCL expression to retrieve all Addresses that have a city equal to "mulhouse".
d. Write an OCL expression to retrieve all Orders that have at least one Item with a price less than 10.
e. Write an OCL expression to retrieve all Orders that have a total greater than 100 and at least one Item with a price less than 10.


9 - 9