Пример #1
0
        public 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);
        }
Пример #2
0
 public void LoadSnacks(int position, SnackPile snackPile)
 {
     GetSlot(position).SnackPile = snackPile;
 }