Source of AccountTest.java


  1: // Fig. N.1: AccountTest.java
  2: // Create and manipulate an Account object.
  3: 
  4: public class AccountTest
  5: {
  6:    // main method begins execution
  7:    public static void main( String args[] ) 
  8:    {
  9:       Account account = new Account( 50.00 ); // create Account object
 10: 
 11:       // display initial balance of Account object
 12:       System.out.printf( "initial account balance: $%.2f\n", 
 13:          account.getBalance() );
 14:       
 15:       double depositAmount = 25.00; // deposit amount
 16:       
 17:       System.out.printf( "\nadding %.2f to account balance\n\n", 
 18:          depositAmount );
 19:       account.credit( depositAmount ); // add to account balance
 20: 
 21:       // display new balance
 22:       System.out.printf( "new account balance: $%.2f\n", 
 23:          account.getBalance() );
 24:    } // end main
 25: 
 26: } // end class AccountTest
 27: 
 28: 
 29: /**************************************************************************
 30:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 31:  * Pearson Education, Inc. All Rights Reserved.                           *
 32:  *                                                                        *
 33:  * DISCLAIMER: The authors and publisher of this book have used their     *
 34:  * best efforts in preparing the book. These efforts include the          *
 35:  * development, research, and testing of the theories and programs        *
 36:  * to determine their effectiveness. The authors and publisher make       *
 37:  * no warranty of any kind, expressed or implied, with regard to these    *
 38:  * programs or to the documentation contained in these books. The authors *
 39:  * and publisher shall not be liable in any event for incidental or       *
 40:  * consequential damages in connection with, or arising out of, the       *
 41:  * furnishing, performance, or use of these programs.                     *
 42:  *************************************************************************/