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(); } }
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(); }
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); }
public static void IfStatement1() { Potato potato = new Potato(); potato.IsPeeled = true; if (potato != null) { if (potato.IsPeeled && !potato.IsRotten) { Cook(potato); } } }
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); }
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); }
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); } } // .... }
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!"); } }
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(); } }
/// <summary> /// method for Task1 /// </summary> /// <param name="input">vegetable(potato) for cooking</param> public static void Cook(Potato input) { throw new NotImplementedException("TODO"); }
private Potato GetPotato() { Potato newPotato = new Potato(); return newPotato; }
private Potato GetPotato() { Potato newPotato = new Potato(); return(newPotato); }