go to previous page   go to home page   go to next page

Answer:

  public static void main( String[] args )
  {
    CheckingAccount account1 = new CheckingAccount( "123", "Bob", 100 );
    account1.display() ;
    account1.processDeposit( 2000 );
    account1.processCheck( 1500 );
    account1.display() ;
    
    CheckingAccount account2 = new CheckingAccount( "007", "James Bond", 50000 );
    account2.display() ;
    account2.processDeposit( 70000 );
    account2.processCheck( 10000 );
    account2.display() ;
    
  }

Further Testing

When the program is run, you will see:

123     Bob     100
123     Bob     585
007     James Bond      50000
007     James Bond      110000

QUESTION 20:

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.