Introduction To UML
Introduction To UML
• system boundaries
• generalizations
• includes
• extensions
Medical clinic diagram, expanded
The following use case diagram expands the original medical clinic diagram with additional features.
UML class notation is a rectangle divided into three parts: class name,
attributes, and operations.
This diagram shows that a BoxOffice belongs to exactly one MovieTheater. Destroy the
MovieTheater and the BoxOffice goes away! The collection of Movies is not so closely bound to
the MovieTheater.
Class information: visibility and scope
The class notation is a 3-piece rectangle with the class name, attributes, and operations. Attributes and
operations can be labeled according to access and scope. Here is a new, expanded Order class.
The class notation is a 3-piece rectangle with the class name, attributes, and operations. Attributes and
operations can be labeled according to access and scope. Here is a new, expanded Order class.
Symbol Access
+ public
- private
# protected
A Hotel Management System
Superb Hotels Group plc.
There are many hotels in the Superb Hotels group.
Each hotel has a distinct name eg Superb Kensington, Superb
Harrogate, Superb Cleckheaton.
Each hotel handles its own room reservations, arrivals, departures and cancellations.
Each hotel is built to a standard design and has 40 bedrooms and 5 function rooms.
Every room (whether it be a bedroom or a function room) has a room number and may be currently occupied
or unoccupied.
All rooms can be booked by customers.
A booking may involve a number of guests and more than one room but will be associated with exactly one
customer's name.
A function room may be occupied by a large number of guests.
Each bedroom can accommodate 1 or 2 people.
The tariff (charge) per night for a bedroom depends on its
type - there is a single bedroom rate and a double bedroom rate.
The hotel reception staff will sometimes need to check on :
the number of beds in a specified bed
whether a bedroom or function room is currently occupied
The hotel keeps a number of Overhead Projectors (OHPs) for use in function rooms.
It is sometimes necessary to place an OHP in a function room or to remove it.
The hotel will wish to keep track of whether a function room currently has an OHP in it or not.
Use Case Diagram
• Actors & Use Cases
• A Customer
– Make a booking (check the booking details to work out the
invoice total)
– Cancel a booking (but must still pay if it’s a late cancellation)
• A Guest
– Arrive and check in (check the booking to make sure the
guest is booked in)
– Depart and check out ( and pay for any damages)
• A Manager
– Check if a room is currently occupied
– Check whether a function room has an OHP located in it
– Install an OHP
– Remove the OHP from a room
As check booking details is confirming different information,
depending on whether the customer
Man ager
Pay for Boo kin g
<<Include/Uses>>
Install OHP
Check In
Guest
<<Extends>>
Check Out
Pay for Damages
Classes
• Hotel
• Hotel Name
• Operation1, Operation2, Handle Arrival, Handle Departure, Handle Reservation,
Handle Cancellation, check No: of Beds, Check If Occupied
• Tariff
• Functional Room
• Capacity, Has OHP
• Check Fore OHP, Remove OHP, install OHP
• Room
• Room No:, is Occupied
• Check If Occupied
• Bedrooms
• No: of Beds
• Check No: of Beds, vacate, occupy
• Guest
• Guest Name
• OHP
• OHP No:
• Booking
• Start Date, No: of Days
• Customer
• Customer Name
• Party
The hotel keeps a number of Overhead
There are many hotels in the Superb Hotels group. FuntionRoom Projectors (OHPs) for use in function
Each hotel has a Hotel
distinct name eg Superb Kensington,capacity
Superb: int OHP
1 rooms. 0..1
Harrogate, Superb Cleckheaton.
hotelN am e : string
hasOHP : Boolean OHPN o : Intege
It is sometimes necessary r
to place an
Each hotel handles its own room reservations, arrivals, departures and cancellations
OHP in a function room or to remove
checkForOHP : boolean()
opera ti on1:voi d() removeOHP : void() it.
opera ti on2: void () installOHP : void()
handel Arrival :voi d() The hotel will wish to keep track of
handleDeparture : voi d() whether a function room currently has
handleReservation : voidEach() hotel is built to a standard design and has 40 bedrooms
an OHPandin 5it or not.
handleCancel la ti on : function
void() rooms.
checkNo OfBeds : void() Room
Every room (whether it be a bedroom
chcekIfOccupi ed : vo id()
or a function room) has a room Booking
roomNo : int
number and may be currently occupied or unoccupied.
isOccupied : int startDate : Date
noOfDays : Integer
Bedroom
The tariff (charge) per night 0..1
for a 1
t ariff noOfBeds
bedroom depends on its customer
type - chargePerNi ght : in t
there is a single bedroom rate checkNoOfBeds() customerName : String
vacat()
and a double bedroom rate. occupy()
0..1
occupies
A booking may involve0..2
a number of 1
Guest
guests and more than one room but will party
guestName : Stri ng A function room may be occupied by a
be associated with exactly one
customer's name. large number of guests.
Sequence diagrams
Interaction diagrams are dynamic. They describe how
objects collaborate.
3: Initialize
5: Enter PIN(1234)
6: Verify PIN
7: Open Account
8: Propmt for Transaction
9: Select Transaction (Withdraw)
3: Initialize Screen
Collaboration Diagram
Card
Reader
6: Verify PIN
7: Open Account
17: Eject Card 12: Withdraw Fund($30)
13: Verify Funds($30)
14: Deduct Funds($30)