Ejemplo n.º 1
0
        public void Cook()
        {
            Potato potato = GetPotato();

            Peel(potato);
            Cut(potato);

            Carrot carrot = GetCarrot();

            Peel(carrot);
            Cut(carrot);

            Bowl bowl = GetBowl();

            bowl.AddIngredient(potato);
            bowl.AddIngredient(carrot);
            bowl.Cook();
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            //Potato potato;
            ////...
            //if (potato != null)
            //    if (!potato.HasNotBeenPeeled && !potato.IsRotten)
            //        Cook(potato);

            Potato potato = new Potato();
            //...

            bool isPeeled = potato.IsPeeled;
            bool isRotten = potato.IsRotten;

            if (potato != null)
            {
                if (isPeeled && !isRotten)
                {
                    potato.Cook();
                }
            }
        }
Ejemplo n.º 3
0
        public static void Main()
        {
            //Potato potato;
            ////...
            //if (potato != null)
            //    if (!potato.HasNotBeenPeeled && !potato.IsRotten)
            //        Cook(potato);

            Potato potato = new Potato();
            //...

            bool isPeeled = potato.IsPeeled;
            bool isRotten = potato.IsRotten;

            if (potato != null)
            {
                if (isPeeled && !isRotten)
                {
                    potato.Cook();
                }
            }
        }