Beispiel #1
0
        public SnackPile(Snack snack, int quantity, decimal price)
        {
            if (quantity < 0 ||
                price < 0 ||
                price % 0.01m > 0)
            {
                throw new InvalidOperationException();
            }

            Snack    = snack;
            Quantity = quantity;
            Price    = price;
        }
Beispiel #2
0
        public SnackPile(Snack snack, int quantity, decimal price) : this()
        {
            if (quantity < 0)
            {
                throw new ArgumentException();
            }

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

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

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