8
Advanced Interaction Modeling
8.1 Here are answers for an electronic gasoline pump.
a. Figure A8.1 shows a use case diagram.
Electronic Gasoline Pump
purchase «include» purchase
gas car wash
Customer
«extend» «extend»
pay credit pay credit
card outside card inside
Cashier
Figure A8.1 Use case diagram for an electronic gasoline pump
b. There are two actors:
■ Customer. A person who initiates the purchase of gas.
■ Cashier. A person who handles manual credit card payments and monitors the sale
of gas.
74
Chapter 8 Answers to Exercises 75
c. There are four use cases:
■ Purchase gas. Obtain gas from the electronic gas pump and pay for it with cash.
■ Purchase car wash. A customer also decides to purchase a car wash and pays for it
with cash.
■ Pay credit card outside. Instead of cash, pay for the gas and optional car wash with
a credit card that is directly handled by the gas system.
■ Pay credit card inside. Instead of cash, pay for the gas and optional car wash with a
credit card that is manually handled by the cashier.
8.2 Figure A8.2 shows a use case diagram for an online travel agent.
Online Travel Agent
«include»
make purchase provide payment info
Customer
«include»
provide address
purchase purchase purchase
flight car rental hotel stay
Figure A8.2 Use case diagram for an online travel agent
8.3 Figure A8.3 shows a use case diagram for the online frequent flyer program. Finding a
free flight is the same as finding a paid flight, except seats are limited for free flights
(hence the extend relationship). When submitting a claim for missing credits, a user must
first view their existing credits (hence the include relationship).
8.4 Figure A8.4 shows a use case diagram for the electronic music management software.
We chose to make the CD an actor, because it is an external entity apart from the elec-
tronic music software.
8.5 Figure A8.5 shows a use case diagram for a simple payroll system.
76 Chapter 8 / Advanced Interaction Modeling
Online Frequent Flyer System
book award
check free
flight avail.
book free book free book free
flight car rental hotel «extend»
check prices
and routes
update account
Customer Airline
change change change
address user name password
submit
missing credit
«include»
view credits
request credit
card application
Figure A8.3 Use case diagram for an online frequent flyer program
Chapter 8 Answers to Exercises 77
Electronic Music Management Software
view songs
view songs view songs view songs view songs
by title by artist by album by genre
start play
stop play
create library
add song
destroy song
«include»
destroy library «include»
«include»
delete library
User
delete song
randomize order
play library «include»
play song
rip CD
create CD
CD
Figure A8.4 Use case diagram for electronic music management software
78 Chapter 8 / Advanced Interaction Modeling
Simple Payroll System
Bank change method
of payment
update records
change change add drop
name address deduction deduction
compute deductions
compute compute compute compute
charity taxes retire sav. other ded.
«include» «include»
«include» «include»
sum deductions
Employee Employer
compute income
compute compute compute
base pay OT pay other pay
«include» «include»
«include»
sum income
«include» «include»
compute net
take home pay
Figure A8.5 Use case diagram for a simple payroll system
Chapter 8 Answers to Exercises 79
8.6 Figure A8.6 computes the contents of a portfolio of stocks.
:StockMgmtSoftware :Portfolio :Transaction
computeContents (date)
getTransactions (endDate)
stockContents := transactionSet
initialComposition +
sum(transactionSet)
Figure A8.6 Sequence diagram for computing the contents of a portfolio of stocks
8.7 Figure A8.7 computes the value of a stock portfolio on a specified date.
:StockMgmtSoftware :Portfolio :AssetValues
computeContents (date)
stockContents
getStockValues (date)
stock_valuePairSet
computeValue (stockContents, stock_valuePairSet)
value
Figure A8.7 Sequence diagram for computing the value of a portfolio of stocks
80 Chapter 8 / Advanced Interaction Modeling
8.8 Figure A8.8 compute the values of a recursive stock portfolio that is limited to three lev-
els deep.
:StockMgmtSoftware :Portfolio :AssetValues
computeContents (date)
portfolio1 := portfolioContents
portfolio2 := stocks in portfolio1;
for each portfolio in portfolio1
portfolio2 += computeContents (date)
portfolio2
getStockValues (date)
stock_valuePairSet
computeValue (portfolio2, stock_valuePairSet)
value
Figure A8.8 Sequence diagram for computing the value of a recursive portfolio
Chapter 8 Answers to Exercises 81
8.9 Figure A8.9 shows the various activities and interactions for a DVD purchase.
Customer Sales Support Engineering Mail Accounting
request help
refer to
support
request help
consult with
engineering
recommend
an option
discuss
options
choose DVD
ship DVD
receive DVD
install DVD
mail payment
handle
payment
Figure A8.9 Activity diagram for a DVD purchase
82 Chapter 8 / Advanced Interaction Modeling
8.10 Figure A8.10 shows an activity diagram for the creation of a product.
Marketing Engineering Manufacturing Service
create idea
:Product
[raw idea] simulate product
:Product check
[proposal] manufacturability
:Product
approve revisions [manufacturable]
Product
[manufacturable check
and correct serviceability
functionality]
:Product
approve revisions [serviceable]
:Product
[fully approved]
Figure A8.10 Activity diagram for the creation of a product