public static void Rect() { bool Choice; EggCarton Carton = new EggCarton(); do { Console.WriteLine("How many White eggs do you have?"); Carton.SetWhiteEggs(int.Parse(Console.ReadLine())); Console.WriteLine("How many Brown eggs do you have"); Carton.SetBrownEggs(int.Parse(Console.ReadLine())); Console.WriteLine("Anymore eggs? yes/no"); string x = Console.ReadLine(); if (x == "yes") { Choice = true; } else if (x == "no") { Choice = false; } else { Choice = true; } } while (Choice); Console.WriteLine("Okay so you have {0} Brown eggs , and {1} White eggs in the Carton.", Carton.GetBrownEggs(), Carton.GetWhiteEggs()); Console.ReadLine(); }
public static void Main() { string choice; int inputA = 0; int inputB = 0; EggCarton egg = new EggCarton(); Console.WriteLine("create carton default. y or n"); choice = Console.ReadLine(); choice = choice.ToLower(); choice = choice[0].ToString(); if (choice == "y") { egg = new EggCarton(); } Console.WriteLine("create carton with eggs. y or n?"); choice = Console.ReadLine(); choice = choice.ToLower(); choice = choice[0].ToString(); if (choice == "y") { Console.WriteLine("how many brown eggs?"); inputA = int.Parse(Console.ReadLine()); Console.WriteLine("How many white eggs"); inputB = int.Parse(Console.ReadLine()); egg = new EggCarton(inputA, inputB); } Console.WriteLine("add white eggs. y or n"); choice = Console.ReadLine(); choice = choice.ToLower(); if (choice[0].ToString() == "y") { Console.WriteLine("how many?"); choice = Console.ReadLine(); egg.setWhiteEggs(int.Parse(choice)); } Console.WriteLine("add brown eggs. y or n"); choice = Console.ReadLine(); choice = choice.ToLower(); if (choice[0].ToString() == "y") { Console.WriteLine("how many?"); choice = Console.ReadLine(); egg.setBrownEggs(int.Parse(choice)); } Console.WriteLine("add eggs by choice. y or n"); choice = Console.ReadLine(); choice = choice.ToLower(); if (choice[0].ToString() == "y") { Console.WriteLine("what color?"); choice = Console.ReadLine(); Console.WriteLine("how many?"); inputA = int.Parse(Console.ReadLine()); egg.addEggs(inputA, choice); } Console.WriteLine("Brown egg count: " + egg.getBrownEggs()); Console.WriteLine("White egg count: " + egg.getWhiteEggs()); Console.WriteLine("Total egg count: " + egg.getTotalEggs()); }