UML Exercises 2022
UML Exercises 2022
UML
Authors:
Teresa Galvão
José Luis Borges
Page 1
The Library example revisited
Page 2
A class diagram for the Library Example
Page 3
1. Formula One Championship
Suppose that you want to store the information related to a season of a Formula One
Championship.
From each constructor, we want to store the name, the country, the number of points awarded in
the Constructor Championship, and the registered cars. From each car, we have to store its
weight, power, and maximum speed.
Concerning the drivers, it is important to store the name, age, nationality, and the number of
points awarded in the Drivers Championship. A driver is assigned to a single car during the
season, although more than one driver can use the same car. This situation is not frequent, but it
may occur due to some accident.
Each season is composed of a set of races. Each race is held in a circuit at a predefined date.
Exceptionally, it is possible to have more than one race in the same circuit. Each circuit is
characterized by its name, city, country, number of laps, and perimeter.
For each race, it is important to store the grid position of each participant driver and their final
classification. It is also important to know who were the drivers that abandoned the race, in
which lap, and the reason for abandonment.
Page 4
Formula One Championship – Class Diagram
Page 5
Formula One Championship
T_Constructor
constructorID name country points Primary Key
T_Driver
driverID name nationality birthDate points carID
T_Race
raceID date circuitID
T_Circuit
circuitID name city country numberLaps perimeter
T_Driver_Result
driverID raceID gridPosition finalClassification abandonedYN reason lap
Page 6
2. AllFestivals Inc.– An Event Management company
AllFestivals is an event management company that organizes festivals and concerts. The company’s
president intends to build an information system to support the information management and hence
improve the efficiency of the company.
The company promotes and organizes events in several venues all over the country and maintains an
updated list of all the bands and musicians to come into contact whenever they need.
Each band is composed of one or more musicians, and each musician may belong to more than one
band. For each musician, it is important to store the name, address, phone number, and the instruments
he plays in that band. Each band has a leader (one of the musicians), and it is important to store his
name and the name of the band. Each instrument is characterized by the name and the family group
(e.g., brass, percussion, strings, etc.).
A venue must have a name, an address, and a phone number. It is also important to know the number
of seats. A show (e.g., concert, festival) can be composed by several bands and solo musicians. The same
show can occur in more than one venue and more than once, but not on the same day. From each show,
it is important to know the title, the bands, and the solo musicians that will participate in it.
Finally, it is also needed to register all the possible venues in which a particular show may take place
even if it doesn't. This information is required to guarantee adequate management of the venue's
availability and conditions.
Page 7
3. GreatTourist– A visitor information center
GreatTourist is a tourist agency that wishes to implement an information system to support the activities of the visitor
information center in Portugal.
A touristic attraction is called a Point of Interest (POI) and is important to store the name, the type (e.g., a museum, a
monument, or a beach), address, phone number, and email (if any). Each POI has a punctuation on a 1-5 scale and an
expected visit duration.
The ticket prices depend on the visitor type. For example, some POIs have special fees for students or elderly people.
The POI schedule (characterized by opening and closing times) depends on the year's season. Each season is
characterized by a name, a start date, and an end date. A POI is located in a place. A place is characterized by a name
and a brief description, and may correspond to a city or a village. As an example of a place, consider Conímbriga,
where we can find two different POI: the Roman ruins and the museum.
It could be interesting to know the hotels and restaurants located at each place and the respective maximum capacity
(to know in advance if they are suitable for large groups). Knowing their name, address, phone number, and email is
also important. We need to know the star rating for the hotels. For the restaurants, we need to know the average meal
price. Each place may have some typical dishes, and it could be interesting for the tourists to know where they can be
appreciated. A name and a brief description characterize each typical dish. Note that the same dish can be popular in
different places (e.g., baked cod).
The information system must register the most noteworthy events. Each event is characterized by a name, a
description, a start date, an end date, and a list of the places where it is celebrated. It should also store a description of
the particular details of the event for a particular place. For example, New Year’s Eve in Madeira Island is famous for
the fireworks.
Finally, the agency would like to define touristic routes that include visits to different POIs. Each route has a name, a
description, total expected duration, and the most appropriate mode of transport. The visiting order of each POI within
each route is also important in order to correctly plan the visits.
Page 10
4. HyperEgo – a Psychology Office
HyperEgo, a psychology office, wants to hire the development of an information system to organize
and manage the clients and technicians.
It is necessary to know the clients' names, addresses, phones, and birth dates. It is also important to
know if a doctor advised the support provided by the office, and, in this case, the system must store
the doctor’s name, his medical specialty, and his phone number. The majority of the clients are
children, but some are adults. About the children, the system must store parents’ names, the name
of the school, and the grade the children are attending. It is necessary to know the adults' occupation
(if any) and their marital status.
The office works with several technicians about whom it is important to know the name, the address,
the phone number, and the specialty (e.g., psychologist, therapist, specialized teacher). Also, the
office provides different services (e.g., psychological counseling, vocational counseling, speech
therapy) that different technicians can perform. Each client can be followed in different services, but
a single technician is responsible for him in each service.
The activities of the HyperEgo office occur in sessions that can be individual or group sessions. The
system must store the date and the participants of each session. A technician is assigned to a session
where several clients and some of their relatives can participate. From these clients’ relatives, it is
important to know the kinship (family relationship) with the client.
During a session, the client can perform tests (e.g., psychometric, WISC, COPS), being important to
know the name, the type of test, and the services with which it is related. Each time a client performs
a test, the system stores the date and its final result.
Page 13
5. The Wire @ Porto – a Police Investigation
The Porto Police Department is planning an extensive investigation related to criminal networks. The board has decided to develop an
information system to manage all the information of this investigation.
When something deserves investigation, the first thing to do is create a process. A process is characterized by a name, beginning date,
and description. Several detectives can be assigned to a process, and it is important to know the role of each one in a process. Each
detective is characterized by a name, address, phone number, and birth date. Please note that each detective can be assigned to more
than one process.
Concerning each process, the system has to store a list of all the defendants. Each defendant is characterized by a name, address, and
phone number. When a defendant is arrested, he is obliged to name the attorney(s) who is (are) going to represent in the process. A
defendant can be associated with several processes, but the attorneys may differ in each process. The system should store each
attorney's name, address, and phone number.
For each defendant, it is important to keep his job, the companies he works in, and the date he has started each job. Each company is
characterized by a name, address, and phone number. Within the scope of a process, several operations can take place, such as pursuits
or wiretaps. Each operation has a date, a name, a description, and a reference to the detective in charge. It is also important to store a
list of all the detectives involved in an operation. Several proofs can be collected during an operation. A proof has a type (e.g., gun or
photo), a description, and a collection date.
When a defendant is arrested, he is subjected to an interrogatory performed by a magistrate. An interrogatory is associated with a
process, has a date, and also start and finish time. The magistrates are characterized by the name and the court he belongs to. From a
court is important to store the name, city, and court type.
The collected proofs could take a magistrate to impose a coercive measure to a defendant (e.g., preventive detention or home
detention), being necessary to keep the starting date, the duration, and a brief description of the reasons that justify this measure. It is
also important to know the magistrate who has imposed the coercive measure.
If the evidence is strong enough, a prosecution is formulated. A prosecution is related to a particular type of crime (characterized by a
name, a minimum, and maximum sentence length). Hence, the system must store the defendant, the type of crime, the proofs
supporting the prosecution, and the associated process for each prosecution. A defendant can be accused of more than one crime of the
same type in a particular process.
Page 16
6. Fitness4All
The Fitness4All gym wants to specify an information system to register its members and manage the use of its
physical spaces and services. Create the UML class diagram based on the requirements defined in the following
paragraphs.
The gym needs to keep the information about all its clients. Thus, when a client enters the gym for the first time, he
must fill out a registration form that includes the name, address, age, and telephone number. The client should also
decide whether he will become a member of the gym or not. A client can be an occasional client, in which case the
gym wants to know if he previously was a member of another gym or not. A member must pay an initial tax when
registering, and he will be given a member’s number. This number should be indicated at the entrance on
subsequent visits. He will only be able to attend the gym with active registration.
Each member is also subject to periodical monitoring that registers parameters such as height, weight, tension, BMI,
monitoring's date, and a short description of the evolution of goals to achieve. A monitor is a specialized person (for
example, a teacher, nutritionist, or physiotherapist) characterized by a name and role.
The gym has different types of classes (e.g., pilates, RPM, etc.) available to members. A name and a duration
characterize each type of class. Each occurring class is of a given type, and it is necessary to register the title, the day
of the week it occurs, and the starting time. Thus, members can enroll in any type of classes available in the gym.
Higher-level classes may have as a prerequisite a lower-level class.
The gym needs to keep track of the rooms where each type of class can occur. Each room is characterized by a name
and a capacity for every kind of class. Additionally, the gym wants to keep track of the trainers who can teach each
class type. It is also important to know the level of expertise of each trainer for every kind of class.
Some teachers like to customize their classes by requesting additional equipment (e.g., a projector). To enable this,
the gym needs to know the equipment each professor needs for each type of class.
Page 19