Beispiel #1
0
        public void Add(Vegetable veggie)
        {
            if (veggie == null)
            {
                throw new ArgumentNullException();
            }

            if (!veggie.IsCut || !veggie.IsPeeled)
            {
                Console.WriteLine("Vegetable must be peeled and cut before being added to the bowl!");
            }
            else
            {
                this.Ingredients.Add(veggie);
            }
        }
Beispiel #2
0
        public Bowl Cook(Vegetable veggie)
        {
            Bowl cookingBowl = new Bowl();

            if (veggie != null)
            {
                cookingBowl.Add(veggie);

                if (cookingBowl.Ingredients.Count == 0)
                {
                    Console.WriteLine("Your attempt at cooking the vegetable was a big failure, vegetables must be peeled, cut and fresh!");
                    return cookingBowl;
                }
                else
                {
                    return cookingBowl;
                }
            }
            else
            {
                throw new ArgumentNullException();
            }
        }