Consider the object model of Figure 5-32 in the book. Using association multiplicity only, can you modify the model such that a developer unfamiliar with the Gregorian calendar could deduce the number of days in each month? Identify additional classes if necessary.
What will be an ideal response?
The purpose of this exercise is to show the limitation of association multiplicities. There is no complete solution to
this problem. A partial solution indicating the number of days in each month is depicted in Figure 5-5. We created
four abstract classes for each of the possible month lengths, 11 classes for each of the nonvariable months and two
classes for the month of February. The part that cannot be resolved with association multiplicities is the definition of
a leap year and that the number of days in February depends on whether the year is leap or not. In practice, this
problem can solved by using informal or OCL constraints, described in more detail in Chapter 9, Object Design:
Specifying Interfaces.
You might also like to view...
Which statement is incorrect about hidden slides?
A) They are unhidden by pressing the Unhide Slide. B) They can still be displayed by pressing H. C) They are displayed as a grayed out thumbnail. D) They are unhidden by pressing the Hide Slide again.
A Visual Basic control with a TabIndex value of 0 receives the focus initially
Indicate whether the statement is true or false