Practice OO and TDD
- Analise the acceptance criteria and structure the process through diagramming
Given a client makes a deposit of 1000 on 10-01-2012 And a deposit of 2000 on 13-01-2012 And a withdrawal of 500 on 14-01-2012 When she prints her bank statement Then she would see
date || credit || debit || balance
14/01/2012 || || 500.00 || 2500.00
13/01/2012 || 2000.00 || || 3000.00
10/01/2012 || 1000.00 || || 1000.00
- it is in reversed chronological order
- A bank account can do (super class):
- deposit, withdrawal, print statement of transactions
- A transaction (sub class) can be either a deposit or a withdrawal
- Printing statement (sub class) contains history of transactions
- All transactions contain date
- should have a default balance of 0
- has deposit method
- has withdrawal method (user should not be allowed to withdraw more than balace permits - edge case)
- has a list of transactions
- has dates of each transaction
- has the list of transactions to print (depends on Transactions class)
- prints the list of transactions
<< Transaction (deposit/withdrawal)
<< Statement
- orchestrates the methods from Transactions and Statement
- has transactions on itself (initialised)
- can call the methods deposit and withdraw
- can print statements