Class Diagram Question With Solutions
Class Diagram Question With Solutions
Task 1: Create a class diagram for a web based public library. A public library typically stores a
collection of books, movies, or other library items available to be borrowed by people living in a
community. Each library member typically has a library account and a library card with the account’s
ID number, which she can use to identify herself to the library. A member’s library account records
which items the member has borrowed and the due date for each borrowed item. Each type of item
has a default rental period, which determines the item’s due date when the item is borrowed. If a
member returns an item after the item’s due date, the member owes a late fee specific for that item,
Solution:
Task 2: Create a class diagram based on the following description. You have been asked to build
a management system for a group of archeologists. The group is comprised of multiple teams of
researchers. Each team has a letter ID (e.g., team A, team B). Each researcher belongs to one of the
teams, and has an ID number, a first name, and a last name. There are two types of researchers: field
and lab staff. Each field staff member has a favorite region (string). Each lab researcher supports up
to 2 field researchers. Some researchers may not be supported by a lab researcher. The company also
manages an inventory of equipment. Researchers of any type may check out up to 3 pieces of
equipment. Each piece of equipment has a serial number and replacement cost.
Solution:
Task 3: Imagine that you are tasked with developing a system for a pizza shop. Given the following
description, create a class diagram (in the form of a UML class diagram). Include all conceptual classes,
attributes, associations, and generalization relationships mentioned in the descriptions. Label all
A customer places orders. A customer has a name and phone number. There are two types of orders:
pick-up and delivery. A pick-up order has a pick-up time. A delivery order has an address and deliver-
by time. All orders consist of a set of items. There are two types of items: pizzas and drinks. All items
have a price. A pizza has a size and a crust type. A pizza also has a number of toppings. A topping has
a topping type and a price. Some pizzas are special pizzas that have a name (e.g., “Hawaiian” or “Meat
Solution: