コード例 #1
0
ファイル: Main.cs プロジェクト: Moiraines/TelerikAcademy
        public static void Main()
        {
            ////Task 1
            Potato potato = new Potato();
            ////...
            if (potato == null)
            {
                throw new ArgumentNullException("Potato is not assigned");
            }
            else
            {
                if (potato.IsPeeled && !potato.IsRotten)
                {
                    Cook(potato);
                }
            }

            ////Task 2
            bool shouldVisitCell = false;
            int x = 0;
            int y = 0;

            ////some code...
            bool isXInRange = IsInRange(x, MinX, MaxX);
            bool isYInRange = IsInRange(y, MinY, MaxY);

            if (isXInRange && isYInRange && shouldVisitCell)
            {
               VisitCell();
            }
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: zdzdz/High-Quality-Code-HW
        public static void Main()
        {
            ////Task 1
            Potato potato = new Potato();

            ////...
            if (potato == null)
            {
                throw new ArgumentNullException("Potato is not assigned");
            }
            else
            {
                if (potato.IsPeeled && !potato.IsRotten)
                {
                    Cook(potato);
                }
            }

            ////Task 2
            bool shouldVisitCell = false;
            int  x = 0;
            int  y = 0;

            ////some code...
            bool isXInRange = IsInRange(x, MinX, MaxX);
            bool isYInRange = IsInRange(y, MinY, MaxY);

            if (isXInRange && isYInRange && shouldVisitCell)
            {
                VisitCell();
            }
        }
コード例 #3
0
        public void Cook(Potato potato, Carrot carrot)
        {
            if (potato == null)
            {
                throw new ArgumentException("ArugumentOutOfPotatoExeption");
            }

            if (carrot == null)
            {
                throw new ArgumentException("ArugumentOutOfCarrotExeption");
            }

            var bowl = this.GetBowl();

            bowl.Add(carrot);
            bowl.Add(potato);

            Console.WriteLine("Your meal contains: ");
            foreach (var vegetable in bowl.Vegetables)
            {
                Console.WriteLine(vegetable);
            }

            Console.ReadKey();
        }
コード例 #4
0
 static void Main()
 {
     Chef test = new Chef("Some Guy");
     Carrot carrot = new Carrot();
     Potato potato = new Potato();
     test.PrepareVegetable(carrot);
     test.PrepareVegetable(potato);
     test.Cook(potato, carrot);
 }
コード例 #5
0
        public static void IfStatement1()
        {
            Potato potato = new Potato();
            potato.IsPeeled = true;

            if (potato != null)
            {
                if (potato.IsPeeled && !potato.IsRotten)
                {
                    Cook(potato);
                }
            }
        }
コード例 #6
0
        internal static void Main()
        {
            Potato goodPotato = new Potato();
            Potato badPotato = new Potato();
            Carrot carrot = new Carrot();
            Chef gRamsay = new Chef("G - Ramsay");

            gRamsay.PrepareVegetable(goodPotato);
            gRamsay.PrepareVegetable(carrot);

            Console.WriteLine("Test 1: (press any key for test 2)");
            CookMeal(gRamsay, goodPotato, carrot);

            Console.WriteLine("Test 2:");
            CookMeal(gRamsay, badPotato, carrot);
        }
コード例 #7
0
        public void Cook()
        {
            Potato potato = this.GetPotato();

            this.Peel(potato);
            this.Cut(potato);

            Carrot carrot = this.GetCarrot();

            this.Peel(carrot);
            this.Cut(carrot);

            Bowl bowl = this.GetBowl();

            bowl.Add(potato);
            bowl.Add(carrot);
        }
コード例 #8
0
        static void Main()
        {
            Chef chef = new Chef();

            {
                Potato potato = new Potato();

                if (potato == null)
                {
                    throw new ArgumentException();
                }

                if (potato.IsPeeled && !potato.IsRotten)
                {
                    chef.CookByProducts(potato);
                }
            }

            // ....
        }
コード例 #9
0
 internal static void CookMeal(Chef chef, Potato potato, Carrot carrot)
 {
     if (potato != null && chef != null)
     {
         if (potato.IsPeeled && !potato.IsRotten)
         {
             chef.Cook(potato, carrot);
         }
         else
         {
             Console.WriteLine(chef.Name + " ANGRY!!! " + chef.Name + " SMASHHH!!!");
             Console.WriteLine("Don't you be givin me no rotten potatoes!");
             Console.ReadLine();
         }
     }
     else
     {
         Console.WriteLine("Where my potato AT!");
     }
 }
コード例 #10
0
        public static void Main()
        {
            // TASK 2

            IPotato potato = new Potato();
            Chef    chef   = new Chef();

            if (potato != null)
            {
                if (!potato.IsRotten && potato.IsPeeled)
                {
                    chef.Cook(potato);
                }
            }

            // -----

            if (IsInColRange() && IsInRowRange() && !IsVisited())
            {
                VisitCell();
            }
        }
コード例 #11
0
ファイル: Main.cs プロジェクト: zdzdz/High-Quality-Code-HW
 /// <summary>
 /// method for Task1
 /// </summary>
 /// <param name="input">vegetable(potato) for cooking</param>
 public static void Cook(Potato input)
 {
     throw new NotImplementedException("TODO");
 }
コード例 #12
0
 private Potato GetPotato()
 {
     Potato newPotato = new Potato();
         return newPotato;
 }
コード例 #13
0
ファイル: Main.cs プロジェクト: Moiraines/TelerikAcademy
 /// <summary>
 /// method for Task1
 /// </summary>
 /// <param name="input">vegetable(potato) for cooking</param>
 public static void Cook(Potato input)
 {
     throw new NotImplementedException("TODO");
 }
コード例 #14
0
        private Potato GetPotato()
        {
            Potato newPotato = new Potato();

            return(newPotato);
        }