示例#1
0
        public virtual void LoadSnacks(int position, SnackPile snackPile)
        {
            Slot slot = Slots.Single(x => x.Position == position);

            //slot.Snack = snack;
            //slot.Quantity = quantity;
            //slot.Price = price;
            slot.SnackPile = snackPile;
        }
示例#2
0
        // solution for client errors display

        public virtual string CanBuySnack(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);
        }
示例#3
0
 public virtual void LoadSnacks(int position, SnackPile snackPile)
 {
     GetSlot(position).SnackPile = snackPile;
 }