Further Testing

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
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.