deposit(double amount) — adds to balance, logs transaction
withdraw(double amount) — subtracts from balance, throws InsufficientFundsException if balance insufficient, logs transaction
printStatement() — prints owner, balance, and all transactions
Then in main: create an account for "Alice" with $1000, deposit $500, withdraw $200, attempt to withdraw $2000 (should catch exception), then print the statement.
Need a hint?
Transaction log: use transactions.add("Deposit: +$" + amount);
Check: if (amount > balance) throw new InsufficientFundsException(...);
Format currency: String.format("$%.2f", balance)
Final balance should be: $1000 + $500 - $200 = $1300.00
Expected Output:
Error: Insufficient funds
--- Statement for Alice ---
Balance: $1300.00
Transactions:
Deposit: +$500.0
Withdrawal: -$200.0
Code Editor
Ready
Output
Console
Console initialized...
Ready for the Final Project: Bank Account Simulator
> This is your capstone — bring everything together!
> Use "Check My Code" to validate, then complete the course!