Exemple #1
0
 private ATM()
 {
     cardExists = new stateCardExists(this);
     noCard = new stateNoCard(this);
     pinExists = new statePinEntered(this);
     atmState = noCard;
 }
Exemple #2
0
 public void SetState(ATMState state)
 {
     if (state == null)
     {
         throw new ArgumentNullException(nameof(state));
     }
     _currentState = state;
 }
Exemple #3
0
 public ATM()
 {
     NoCard       = new NoCardState(this);
     CardEntered  = new CardEnteredState(this);
     NoMoney      = new NoMoneyState(this);
     PinEntered   = new PinEnteredState(this);
     CurrentState = NoCard;
     Amount       = 1000;
 }
    public ATMMachine()
    {
        atmState = new NoCard(this);;

        if (cashInMachine < 0)
        {
            atmState = new NoCash(this);
        }
    }
        public void EjectDebitCard()
        {
            _atmMachineState.EjectDebitCard();
            _cardInserted = null;

            if (_atmMachineState is DebitCardInsertedState)
            {
                _atmMachineState = new DebitCardNotInsertedState();
            }
        }
        public void InsertDebitCard(Card card)
        {
            _cardInserted = card;
            _server.ReadInformationFromCard(card);
            _atmMachineState.InsertDebitCard(card);

            if (_atmMachineState is DebitCardNotInsertedState)
            {
                _atmMachineState = new DebitCardInsertedState(_server);
            }
        }
Exemple #7
0
        public ATMMachine()
        {
            Hascard    = new hascard(this);
            Nocard     = new nocard(this);
            Correctpin = new correctpin(this);
            Outofmoney = new outofmoney(this);

            atmstate = Nocard;
            if (money < 0)
            {
                atmstate = Outofmoney;
            }
        }
        public ATMMachine()
        {
            hasCard       = new HasCard(this);
            noCard        = new NoCard(this);
            hasCorrectPin = new HasPin(this);
            atmOutOfMoney = new NoCash(this);

            atmState = noCard;
            if (cashInMachine < 0)
            {
                atmState = atmOutOfMoney;
            }
        }
Exemple #9
0
        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 ATMMachine()
        {
            this.hasCard       = new HasCard(this);
            this.noCard        = new NoCard(this);
            this.hasCorrectPin = new HasPin(this);
            this.atmOutOfMoney = new NoCash(this);

            this.atmState = this.noCard;

            if ((this.CashInMachine < 0))
            {
                this.atmState = this.atmOutOfMoney;
            }
        }
Exemple #11
0
        public ATMMachine()
        {
            HasCard       = new HasCard(this);
            NoCard        = new NoCard(this);
            HasCorrectPin = new HasPin(this);
            AtmOutOfMoney = new NoCash(this);

            AtmState = NoCard;

            if (CashInMachine < 0)
            {
                AtmState = AtmOutOfMoney;
            }
        }
Exemple #12
0
 public ATM()
 {
     _currentState = new NoCardState(1000, this);
 }
Exemple #13
0
 public CashWithdrawnState(ATMState state) : this(state.DummyCashPresent, state.Atm)
 {
 }
 public void SetATMState(ATMState newATMState)
 {
     currentAtmState = newATMState;
 }
 public ATMMachine(Server server)
 {
     _server          = server;
     _cardInserted    = null;
     _atmMachineState = new DebitCardNotInsertedState();
 }
Exemple #16
0
 public void changeState(ATMState g)
 {
     atmstate = g;
 }
Exemple #17
0
 public void SetState(ATMState newState)
 {
     this.atmState = newState;
 }
 public void setATMState(ATMState newATMState)
 {
     atmState = newATMState;
 }
Exemple #19
0
 public void SetATMState(ATMState state)
 {
     atmState = state;
 }
 // This constructor will create new state taking values from old state
 public NoCashState(ATMState state)
     : this(state.DummyCashPresent, state.Atm)
 {
 }
Exemple #21
0
 public ATMMachine()
 {
     atmMachineState = new DebitCardNotInsertedState();
 }
Exemple #22
0
 // This constructor will create new state taking values from old state
 public CardValidatedState(ATMState state)
     : this(state.DummyCashPresent, state.Atm)
 {
 }