// COBOL Programmers Swing With Java - copyright 2005 Doke, Hardgrave, & Johnson // Chapter 5 - Computation // Program to model the AccountProcessor class // AccountProcessor.java 1 JAN 05 public class AccountProcessor { public static void main (String args[]) // main is executed first { // attribute values int accountNumber = 12345; float currentBalance = 50.00F; // create a checking account object CheckingAccount anAccount = new CheckingAccount(accountNumber, currentBalance); // retrieve and display current balance System.out.println ("Beginning Balance: " + anAccount.getCurrentBalance()); try {// post a $20 check then again retrieve and display current balance anAccount.recordACheck (20.00F); System.out.println ("Balance After $20 check: " + anAccount.getCurrentBalance()); // post a $15 deposit then again retrieve and display balance anAccount.recordADeposit (15.00F); System.out.println ("Balance After $15 deposit: " + anAccount.getCurrentBalance()); // now try posting a $100 check anAccount.recordACheck (100.00F); System.out.println ("Balance After $100 check: " + anAccount.getCurrentBalance()); } // end try block catch (NSFException e) { System.out.println ("Caught NSFException" + e); } // end catch } // end main } // end of accountProcessor.java