public static void main( String[] args )
{
CheckingAccount account1 = new CheckingAccount( "123", "Bob", 100 );
System.out.println( account1.toString() );
account1.processDeposit( 2000 );
account1.processCheck( 1500 );
System.out.println( account1.toString() );
CheckingAccount account2 = new CheckingAccount( "007", "James Bond", 50000 );
System.out.println( account2.toString() );
account2.processDeposit( 70000 );
account2.processCheck( 10000 );
System.out.println( account2.toString() );
}
When the program is run, you will see:
C:\CAI\Notes\chap32>java CheckingAccountTester Account: 123; Owner: Bob; Balance: 100 Account: 123; Owner: Bob; Balance: 585 Account: 007; Owner: James Bond; Balance: 50000 Account: 007; Owner: James Bond; Balance: 110000 C:\CAI\Notes\chap32>
Now try to do something a little bit tricky.
Say that James wrote out a $300 check to Bob,
and that Bob deposited the check in Bob's account.
Add statements
(after all the others in the main
method) that do this.