Source of Transaction.java


  1: // Transaction.java
  2: // Abstract superclass Transaction represents an ATM transaction

  4: public abstract class Transaction
  5: {
  6:    private int accountNumber; // indicates account involved
  7:    private Screen screen; // ATM's screen
  8:    private BankDatabase bankDatabase; // account info database

 10:    // Transaction constructor invoked by subclasses using super()
 11:    public Transaction( int userAccountNumber, Screen atmScreen, 
 12:       BankDatabase atmBankDatabase )
 13:    {
 14:       accountNumber = userAccountNumber;
 15:       screen = atmScreen;
 16:       bankDatabase = atmBankDatabase;
 17:    } // end Transaction constructor

 19:    // return account number 
 20:    public int getAccountNumber()
 21:    {
 22:       return accountNumber; 
 23:    } // end method getAccountNumber

 25:    // return reference to screen
 26:    public Screen getScreen()
 27:    {
 28:       return screen;
 29:    } // end method getScreen

 31:    // return reference to bank database
 32:    public BankDatabase getBankDatabase()
 33:    {
 34:       return bankDatabase;
 35:    } // end method getBankDatabase

 37:    // perform the transaction (overridden by each subclass)
 38:    abstract public void execute();
 39: } // end class Transaction



 43: /**************************************************************************
 44:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 45:  * Pearson Education, Inc. All Rights Reserved.                           *
 46:  *                                                                        *
 47:  * DISCLAIMER: The authors and publisher of this book have used their     *
 48:  * best efforts in preparing the book. These efforts include the          *
 49:  * development, research, and testing of the theories and programs        *
 50:  * to determine their effectiveness. The authors and publisher make       *
 51:  * no warranty of any kind, expressed or implied, with regard to these    *
 52:  * programs or to the documentation contained in these books. The authors *
 53:  * and publisher shall not be liable in any event for incidental or       *
 54:  * consequential damages in connection with, or arising out of, the       *
 55:  * furnishing, performance, or use of these programs.                     *
 56:  *************************************************************************/