Beispiel #1
0
        public void SetAmountInMachine(uint amount)
        {
            Console.WriteLine("The new amount has been set.");
            machine.AmountInMachine = amount;

            if (amount == 0)
            {
                machine.SetMachineState(machine.GetNoCashState());
            }
        }
 public void WithdrawCash(int cash)
 {
     if (machine.AmountInMachine >= cash)
     {
         Console.WriteLine("{0} is withdrawn from the machine", cash);
         machine.setAmountInMachine(machine.AmountInMachine - cash);
         RejectCard();
         if (machine.AmountInMachine == 0)
         {
             machine.SetMachineState(machine.GetNoCashState());
         }
         // Am i missing anything here ?
     }
     else
     {
         Console.WriteLine("Not enough cash available in the machine");
         RejectCard();
     }
 }