Professional Documents
Culture Documents
ATM - TXT - Notepad
ATM - TXT - Notepad
txt
// ATM.cpp
// Member-function definitions for class ATM.
#include "ATM.h" // ATM class definition
#include "Transaction.h" // Transaction class definition
#include "BalanceInquiry.h" // BalanceInquiry class
definition
#include "Withdrawal.h" // Withdrawal class definition
#include "Deposit.h" // Deposit class definition
// start ATM
void ATM::run()
{
// welcome and authenticate user; perform transactions
while ( true )
{
Page 1
ATM.txt
// loop while user is not yet authenticated
while ( !userAuthenticated )
{
screen.displayMessageLine( "\nWelcome!" );
authenticateUser(); // authenticate user
} // end while
currentTransactionPtr->execute(); // execute
transaction
break;
case EXIT: // user chose to terminate session
screen.displayMessageLine( "\nExiting the
system..." );
userExited = true; // this ATM session should end
break;
Page 4
ATM.txt
default: // user did not enter an integer from 1-4
screen.displayMessageLine(
"\nYou did not enter a valid selection. Try
again." );
break;
} // end switch
} // end while
} // end function performTransactions
/***********************************************
***************************
* (C) Copyright 1992-2005 by Deitel & Associates, Inc.
and *
* Pearson Education, Inc. All Rights Reserved.
*
* *
Page 6
ATM.txt
* DISCLAIMER: The authors and publisher of this book
have used their *
* best efforts in preparing the book. These efforts include
the *
* development, research, and testing of the theories and
programs *
* to determine their effectiveness. The authors and
publisher make *
* no warranty of any kind, expressed or implied, with
regard to these *
* programs or to the documentation contained in these
books. The authors *
* and publisher shall not be liable in any event for
incidental or *
* consequential damages in connection with, or arising
out of, the *
* furnishing, performance, or use of these programs.
*
************************************************
**************************/
Page 7