- 2069 Bhadra · 3×3 marks
Money transfer sequence diagram questions
Short answer
Two classes (Account and Person); events: John sends xfer(m,a2), a1 calls check(), if OK a1.minus(m) and sends plus(m) to a2; check() ensures sufficient balance and account validity, preventing invalid transfers.
Based on the below diagram for model action of money transfer, answer the following questions: (a) How many numbers of classes are involved in this transfer activity? What are they? (b) What are the events followed for transfer complete? (c) Why this check( ) function is required for this transfer? [Figure: sequence diagram with lifelines a1:Account, a2:Account and John:Person. a1:Account receives the message xfer(m:Money, a2), then calls check() on itself with a return 'evaluation'; then, if [OK], calls minus(m) on itself and sends plus(m) to a2:Account.]
(a) Number of classes involved
Two classes are involved: Account (the lifelines a1:Account and a2:Account are two objects of the same class) and Person (John:Person, the actor/initiator). So there are three objects but two classes.
(b) Events followed for the transfer to complete
Johnsendsxfer(m:Money, a2)toa1:Account.a1callscheck()on itself to evaluate whether the balance is sufficient; it returnsevaluation.- If the result is [OK],
a1callsminus(m)on itself to reduce its balance bym. a1sendsplus(m)toa2:Account, which increases its balance bym.- The transfer is complete; control returns to John.
John:Person a1:Account a2:Account
| xfer(m,a2) | |
|------------>| |
| |--check()-. |
| |<-evaluation |
| | [OK] |
| |--minus(m)-. |
| |------plus(m)>|
(c) Why check() is required
check() verifies the business rule that the source account has enough balance (and is valid/active) before any money is moved. Its result (evaluation) is the guard [OK] for the following messages. Without it, a1 could be overdrawn, or money could be transferred out of an invalid or blocked account, leaving the accounts in an invalid state. Because both minus(m) and plus(m) are sent only when the guard is [OK], a failed check stops the whole transfer before any balance changes.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- ATM withdrawal sequence diagram · Object Oriented Analysis and Design, chapter 2
- Explain online order sequence diagram · Object Oriented Analysis and Design, chapter 2
- Map sequence diagram to pseudo code · Object Oriented Analysis and Design, chapter 4
- Identify conceptual classes; create domain model · Object Oriented Analysis and Design, chapter 2
- Essential components of an activity diagram · Object Oriented Analysis and Design, chapter 2
- External actors and library system sequence diagram · Object Oriented Analysis and Design, chapter 2
- Transfer function from state model [0 1; −5 −6] · Control Systems, chapter 8 · asked 3×
- Armature-controlled DC motor transfer function and block diagram · Control Systems, chapter 2
- PID controller block diagram, transfer function, characteristics · Control Systems, chapter 7
- Succession of events; GPSS telephone model · Simulation and Modeling, chapter 9
All Object Oriented Analysis and Design chapter 2 questions →