22.5 Recommended Resources
Example -- Implementing the Account class
UML diagram of the Account class from Deitel and Deitel's ATM example.
Found in the CSUSB's Library->EBooks->Safari->Deitel->... page306. This
is part of an ATM program running at a bank. Typical scenario involves the
customer providing a PIN and inputting money and getting money. These effect the
customer's account.
Note 1: credits from the ATM are not immediatly available but are added to the total balance
until confirmed by a separate application run inside the bank...
Note 2: The Account does not verify that the Customer
has available funds. This responsibility is allocated to the
"Withdrawal" class which acts as a session Controller for Customer withdrawals.
Note 3: The Account will need a constructor... and for testing something
like this
Account ( int acctN, int PIN, double aBal, double tBal);
will fit the class diagram well. The resulting file looks like:
[ Account.cpp ]
Here is the TDD test:
[ test.Account.cpp ]
which fails to even compile.
We will now "Do The Simplest Thing That Could Possibly Work" and so
develop the code for the class.
Exercises on Mapping Diagrams to Code
Questions and Answers
[ 14q.html ]
Next -- Back to Analysis again
[ 15.html ]
for reading etc.
Next Iteration of project -- Find examples of GRASP in your project
[ w6.html ]
due at start of class 15.
Review Questions
[ 14r.html ]
Standard Definitions