Java Reference
In-Depth Information
Enter PIN: 1234
A=Checking, B=Savings, C=Quit: A
Balance=0.0
A=Deposit, B=Withdrawal, C=Cancel: A
Amount: 1000
A=Checking, B=Savings, C=Quit: C
In our solution, only the user interface classes are affected by the choice of user
interface. The remainder of the classes can be used for both solutionsȌthey are
decoupled from the user interface.
Because this is a simulation, the ATM does not actually communicate with a bank.
It simply loads a set of customer numbers and PINs from a file. All accounts are
initialized with a zero balance.
12.5.2 CRC Cards
We will again follow the recipe of Section 12.2 and show how to discover classes,
responsibilities, and relationships and how to obtain a detailed design for the ATM
program.
Recall that the first rule for finding classes is ȒLook for nouns in the problem
descriptionȓ. Here is a list of the nouns:
ATM
User
Keypad
Display
Display message
Button
State
Bank account
Checking account
Savings account
Customer
Customer number
PIN
Bank
Of course, not all of these nouns will become names of classes, and we may yet
discover the need for classes that aren't in this list, but it is a good start.
Search WWH ::




Custom Search