Exemple #1
0
        public SnackPile(Snack snack, decimal price, int quantity)
        {
            if (quantity < 0)
            {
                throw new InvalidOperationException();
            }

            if (price < 0)
            {
                throw new InvalidOperationException();
            }

            if (price % 0.01m > 0)
            {
                throw new InvalidOperationException();
            }

            Snack    = snack;
            Price    = price;
            Quantity = quantity;
        }