For this exercise you will be creating a BankAccount class.
It will have the following properties...
type
(e.g., "checking"), which should be determined by some inputmoney
, which should start out as0
It should have the following methods...
withdraw
, which should decrease the amount of money by some inputdeposit
, which should increase the amount of money by some inputshowBalance
, which should print the amount of money in the bank to the console.
The BankAccount
class has a transactionHistory
property which keeps track of the withdrawals and deposits made to the account.
- Make sure to indicate whether the transaction increased or decreased the amount of money in the bank.
Give the BankAccount
class a backupAccount
property that can, optionally, contain a reference to another instance of the class, determined by some input
- Whenever a BankAccount's balance goes below zero, it will remove money from the instance stored in
backupAccount
so that its balance goes back to zero. - This should trigger a withdrawal in the back up account equal to the amount of money that was withdrawn from the original account.