The ATM Side of the Application
// ATMMain.cpp: The main driving routine for the ATM side of the
// application. This main function initializes the Card Slot
// directory (to simulate the card slot of the card reader), and ATM
// Slot directory (to simulate the ATM slot where the ATM puts the
// cards it eats. These are initialized from two command line
// arguments, which are passed in to the main program. It then
// builds a network object, which would require some parameter to
// initialize a particular byte-transmission mechanism in the
// real world. For this simulation, the user will type in strings to
// simulate information transmitted over a network of some kind.
// The main method then builds BankProxy around the network and
// uses it to create an ATM object. It then activates the ATM
// object, which sits in an infinite loop waiting for bank cards.
#include <iostream.h>
#include ''network.hpp''
#include ''atm.hpp''
#include ''trans.hpp''
int
main(int argc, char** argv)
{
if (argc != 3) {
cout << ''Usage: '' << argv[0] << '' CardSlotsATMSlots\n'';
return(1);
}
Network *network = new Network;
BankProxy* MyBank = new BankProxy(network);
ATM *a1 = new ATM(MyBank, ''ATM1'', 8500.00);
strcpy(CardSlots, argv[1]);
strcpy(ATMSlots, argv[2]);
a1->activate();
delete MyBank;
delete a1;
return(0);
}
|