[go: up one dir, main page]

0% found this document useful (0 votes)
36 views3 pages

Lab Assignment 14

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views3 pages

Lab Assignment 14

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

LAB ASSIGNMENT-14

SAI VISHNU ALABAKA


2103a52002
Batch-27

1. Consider the following UML diagram.


(a) If there are 6 authors, what's the minimum and maximum number of books?
What's the minimum and maximum number of readers?
(b) If there are 6 readers, what's the minimum and maximum number of books?
What's the minimum and maximum number of authors?
ANSWER:

 Author can write 1 to 2 Books .


 One Book can be written by 1 to 3 Authors.
 A Reader can read 0 to 4 Books.

(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

Minimum Maximum Minimum Maximum Minimum Maximum


Scenario
Books Books Readers Readers Authors Authors

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.

You might also like