Beispiel #1
0
        public void requestCash(int cashToWithdraw)
        {
            if (cashToWithdraw > atmMachine.cashInMachine)
            {
                Console.WriteLine("Not enough cash.");
                Console.WriteLine("Card ejected.");
                atmMachine.setAtmState(atmMachine.getNoCardState());
            }
            else
            {
                Console.WriteLine($"{cashToWithdraw} provided by the machine.");
                atmMachine.SetCashInMachine(atmMachine.cashInMachine - cashToWithdraw);
                Console.WriteLine("Card ejected.");
                atmMachine.setAtmState(atmMachine.getNoCardState());

                if (atmMachine.cashInMachine <= 0)
                {
                    atmMachine.setAtmState(atmMachine.getNoCashState());
                }
            }
        }
Beispiel #2
0
        public void requestCash(int cashToWithdraw)
        {
            if (cashToWithdraw > atmMachine.cashInMachine)
            {
                Console.WriteLine("You don't have that much cash available");
                Console.WriteLine("Your card is ejected");
                atmMachine.setATMState(atmMachine.getNoCardState());
            }
            else
            {
                Console.WriteLine(cashToWithdraw + " is provided by the machine");
                atmMachine.setCashInMachine(atmMachine.cashInMachine - cashToWithdraw);

                Console.WriteLine("Your card is ejected");
                atmMachine.setATMState(atmMachine.getNoCardState());

                if (atmMachine.cashInMachine <= 0)
                {
                    atmMachine.setATMState(atmMachine.getNoCashState());
                }
            }
        }