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

Answer:

Of course not. Now there is all the fun of testing the implementation.


More Testing

Here is an expanded test program for the class. The class itself is given in the previous page, so if you are going to run this program (could there be any doubt?) you will have to copy and paste two things into your text editor.


class CheckingAccount
{
  . . . .
}

class CheckingAccountTester
{
  public static void main( String[] args )
  {
    CheckingAccount account1 = new CheckingAccount( "123", "Bob", 100 );

    System.out.println( account1.getBalance() );
    account1.processDeposit( 2000 );
    account1.processCheck( 1500 );
    System.out.println( account1.getBalance() );

  }
}

Another way to organize this program is to copy the CheckingAccount class into a file CheckingAccount.java. Then copy the CheckingAccountTester class on this page into a file CheckingAccountTester.java in the same disk directory. Then enter the commands

C:\chap32\> javac CheckingAccount.java CheckingAccountTester.java
C:\chap32\> java CheckingAccountTester

The name of the file for the java command is the one that contains main().


QUESTION 17:

What does the output of this test program look like?