## CRC Cards for ATM Example

Using CRC cards to assign responsibiities to various classes for the tasks required by the various use cases leads to the creation of the following cards.

The following links can be used to go directly to the CRC cards for the various classes:

- Class ATM
- Boundary/entity objects - component parts of the ATM
  - Class CardReader
  - Class CashDispenser
  - Class CustomerConsole
  - Class EnvelopeAcceptor
  - Class Log
  - Class NetworkToBank
  - Class OperatorPanel
  - Class ReceiptPrinter
- Controller objects corresponding to the various use cases
  - Class Session
  - Class Transaction
  - Class Withdrawal
  - Class Deposit
  - Class Transfer
  - Class Inquiry
- Entity objects found necessary when assigning responsiblities to other objects
  - Class Balances
  - Class Card
  - Class Message
  - Class Receipt
  - Class Status

### Class ATM

Responsibilities | Collaborators
--- | ---
Start up when switch is turned on | OperatorPanel CashDispenser NetworkToBank
Shut down when switch is turned off | NetworkToBank
Start a new session when card is inserted by customer | CustomerConsole Session
Provide access to component parts for sessions and transactions |

[ Links for this class ]

### Class CardReader

Responsibilities | Collaborators
--- | ---
Tell ATM when card is inserted | ATM
Read information from card | Card
Eject card |
Retain card |

[ Links for this class ]

### Class CashDispenser

Responsibilities | Collaborators
--- | ---
Keep track of cash on hand, starting with initial amount |
Report whether enough cash is available |
Dispense cash | Log

[ Links for this class ]

### Class CustomerConsole

Responsibilities | Collaborators
--- | ---
Display a message |
Display a prompt, accept a PIN from keyboard |
Display a prompt and menu, accept a choice from keyboard |
Display a prompt, accept a dollar amount from keyboard |
Respond to cancel key being pressed by customer |

[ Links for this class ]

### Class EnvelopeAcceptor

Responsibilities | Collaborators
--- | ---
Accept envelope from customer; report if timed out or cancelled | Log

[ Links for this class ]

### Class Log

Responsibilities | Collaborators
--- | ---
Log messages sent to bank |
Log responses from bank |
Log dispensing of cash |
Log receiving an envelope |

[ Links for this class ]

### Class NetworkToBank

Responsibilities | Collaborators
--- | ---
Initiate connection to bank at startup |
Send message to bank and wait for response | Message Log Balances Status
Terminate connection to bank at shutdown |

[ Links for this class ]

### Class OperatorPanel

Responsibilities | Collaborators
--- | ---
Inform ATM of changes to state of switch | ATM
Allow operator to specify amount of initial cash |

[ Links for this class ]

### Class ReceiptPrinter

Responsibilities | Collaborators
--- | ---
Print receipt | Receipt

[ Links for this class ]

### Class Session

Responsibilities | Collaborators
--- | ---
Perform session use case | ATM CardReader Card CustomerConsole Transaction
Update PIN value if customer has to re-enter it

[ Links for this class ]

### Abstract Class Transaction

Responsibilities | Collaborators
--- | ---
Allow customer to choose a type of transaction | ATM CustomerConsole Withdrawal Deposit Transfer Inquiry
Perform Transaction Use Case | ATM CustomerConsole Withdrawal Deposit Transfer Inquiry Message NetworkToBank Receipt ReceiptPrinter
Perform invalid PIN extension | CustomerConsole Session CardReader

[ Links for this class ]

### Class Withdrawal

Responsibilities | Collaborators
--- | ---
Perform operations peculiar to withdrawal transaction use case | CustomerConsole CashDispenser Message Receipt

[ Links for this class ]

### Class Deposit

Responsibilities | Collaborators
--- | ---
Perform operations peculiar to deposit transaction use case | CustomerConsole Message EnvelopeAcceptor Receipt

[ Links for this class ]

### Class Transfer

Responsibilities | Collaborators
--- | ---
Perform operations peculiar to transfer transaction use case | CustomerConsole Message Receipt

[ Links for this class ]

### Class Inquiry

Responsibilities | Collaborators
--- | ---
Perform operations peculiar to inquiry transaction use case | CustomerConsole Message Receipt

[ Links for this class ]

### Class Balances

Responsibilities | Collaborators
--- | ---
Represent account balance information returned by bank |

[ Links for this class ]

### Class Card

Responsibilities | Collaborators
--- | ---
Represent information encoded on customer's ATM card |

[ Links for this class ]

### Class Message

Responsibilities | Collaborators
--- | ---
Represent information to be sent over network to bank |

[ Links for this class ]

### Class Receipt

Responsibilities | Collaborators
--- | ---
Represent information to be printed on a receipt |

[ Links for this class ]

### Class Status

Responsibilities | Collaborators
--- | ---
Represent transaction status information returned by bank |

[ Links for this class ]

Page of links for non frames-enabled browsers.

###### Copyright © 2000, 2001, 2002 - Russell C. Bjork. Permission for non-commercial reproduction for educational use is hereby granted; all other rights are reserved.