transactionFee
to go in the BankAccount
class.
It takes a fee (real number) parameter and applies the fee to all past transactions.
The fee is applied once for the first transaction, 2x for the second, 3x for the third, etc.
These fees are subtracted from the account's balance.
true
.
If not, the balance is 0.0 and it returns false
. For example:
BankAccount savings = new BankAccount("Jimmy", 0.00); savings.deposit(10.00); savings.deposit(50.00); savings.deposit(10.00); savings.deposit(70.00); // balance = $140, with 4 transactions savings.transactionFee(5.00); // deducts $5+10+15+20; balance = $90; returns true savings.transactionFee(10.00); // deducts $10+20+30+40; balance = $0; returns false