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

Say that James wrote out a $300 check to Bob, and that Bob deposited the check in Bob's account.

Answer:

  public static void main( String[] args )
  {
     . . . . . .
    
    int check = 30000;
    account2.processCheck( check );
    account1.processDeposit( check );
    System.out.println( account1.toString() );
    System.out.println( account2.toString() );
    
  }

Aliasing (Review)

This is not really part of testing this class, but it is convenient to mention aliasing again. Recall that there can be more than one reference to a given object. Each reference is called an alias. Here is another test program, set up to show this:

class CheckingAccount
{
  . . . . 
}

public class CheckingAccountTester
{
  public static void main( String[] args )
  {
    CheckingAccount account1 = new CheckingAccount( "123", "Bob", 100 );
    CheckingAccount account2 = new CheckingAccount( "456", "Jill", 900 );
    CheckingAccount account3; 
    
    System.out.println( account1.toString() );
    System.out.println( account2.toString() );

    account3 = account1;
    System.out.println( account3.toString() );
  }
}

QUESTION 19:


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