Пример #1
0
        public virtual string CanBySnack(int position)
        {
            SnackPile snackPile = GetSnackPile(position);

            if (snackPile.Quantity == 0)
            {
                return("The snack pile is empty");
            }

            if (MoneyInTransaction < snackPile.Price)
            {
                return("Not enough money");
            }

            if (!MoneyInside.CanAllocate(MoneyInTransaction - snackPile.Price))
            {
                return("Not enough change");
            }

            return(string.Empty);
        }
Пример #2
0
        public virtual void LoadSnacks(int position, SnackPile snackPile)
        {
            var slot = GetSlot(position);

            slot.LoadSnack(snackPile);
        }
Пример #3
0
        public virtual void LoadSnacks(int position, SnackPile snackPile)
        {
            Slot slot = GetSlot(position);

            slot.SnackPile = snackPile;
        }
Пример #4
0
 public Slot(SnackMachine snackMachine, int position) : this()
 {
     SnackMachine = snackMachine;
     Position     = position;
     SnackPile    = SnackPile.Empty;
 }
Пример #5
0
 public virtual void LoadSnack(SnackPile snackPile)
 {
     SnackPile = snackPile;
 }
Пример #6
0
 public virtual void LoadSnack(int position, SnackPile snackPile)
 {
     GetSlot(position).SnackPile = snackPile;
 }