// AccountExample.java // Program that uses the Account class public class AccountExample { public static void main(String[] args) { // create three accounts Account danielAccount = new Account(123, 50); Account timAccount = new Account(234); Account billAccount = new Account(555, 10000); // display current balances System.out.println("Daniel has " + danielAccount.getBalance() + " dollars"); System.out.println("Tim has " + timAccount.getBalance() + " dollars"); System.out.println("Bill has " + billAccount.getBalance() + " dollars"); // withdraw $100 from Bill's account // deposit $100 into Tim's account billAccount.withdraw(100); timAccount.deposit(100); System.out.println("Moved $100 from Bill's account to Tim's account"); // display current balances System.out.println("Daniel has " + danielAccount.getBalance() + " dollars"); System.out.println("Tim has " + timAccount.getBalance() + " dollars"); System.out.println("Bill has " + billAccount.getBalance() + " dollars"); // display the accounts (invokes toString() method): System.out.println("The accounts: " + danielAccount + ", " + timAccount + ", " + billAccount); } }