Example #1
0
        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);
        }
Example #2
0
        public virtual void LoadSnacks(int position, SnackPile snackPile)
        {
            Slot slot = GetSlot(position);

            slot.SnackPile = snackPile;
        }