public AtmStateMachine(Money cash) { _currentState = Initial = new InitialState(this); CardInserted = new CardInserted(this); PinEntered = new PinEntered(this); CashWithdrawn = new CashWithdrawn(this); CashAmount = cash; }
public void EjectDebitCard() { AtmMachineState.EjectDebitCard(); // Debit Card has been ejected so internal state of ATM Machine // has been changed to 'DebitCardNotInsertedState' if (AtmMachineState is DebitCardInsertedState) { AtmMachineState = new DebitCardNotInsertedState(); Console.WriteLine("ATM Machine internal state has been moved to : " + AtmMachineState.GetType().Name); } }
public void SetState(IAtmState newState) { _currentState = newState; }
public AtmMachine() { AtmMachineState = new DebitCardNotInsertedState(); }