Lab Assignment 14
Lab Assignment 14
(a) 6 Authors:
Minimum Books: Since each author can write at least 1 book (1..2), with 6
authors there must be at least 3 books.
Maximum Books: Each author can write up to 3 books, so in the maximum
scenario, there would be 18 books (6 x 3 = 18).
Minimum Readers: Readers are not directly connected to Authors or Books in
the diagram. There could be zero readers (minimum 0 readers).
Maximum Readers: There's no limit on the number of readers (maximum
unlimited readers).
(b) 6 Readers:
Minimum & Maximum Books: A reader can read between 2 to unlimited books.
Minimum Authors: readers are not directly connected to Authors or Books.
There could be one author (minimum 1 author).
Maximum Authors: Each book can be written by up to 3 authors, and there is no
limit on how many books a reader might choose to read. So, the maximum number
of authors is unlimited.
Summary Table
6
3 18 0 72 0 Unlimited
Authors
6
2 Unlimited 0 Unlimited 1 Unlimited
Readers
2. Consider a tiny social network containing high school students and their "crushes"
(desired romantic relationships). Each student may have a crush on at most one
other student, and associated with each crush is the length of time the crush has
been going on. Students have a name and a grade, and names are unique. Draw a
UML diagram that models this information. Make sure to capture the asymmetry
and multiplicity of the crush relationship.
3. Consider a class Book with four subclasses: Anthology, Fiction, Children, and
Nonfiction. Is the subclassing relationship overlapping or disjoint (exclusive)? Is it
complete or incomplete (partial)?
ANSWER:
In class Book with sub classes: Anthology, Fiction, Children and Non-fiction. The
sub classes relationship is overlapping and complete.
The subclass relationship is complete because all instances of the superclass (Book)
are covered by one or more of its subclasses (Anthology, Fiction, Children,
Nonfiction). Every book must fall into one of these categories.
The subclass relationship is overlapping because, an instance of the superclass can
belong to more than one subclass simultaneously.