public static void CollectInput(Farm farm) { Console.WriteLine("1. Grazing field"); Console.WriteLine("2. Chicken House"); Console.WriteLine("3. Duck House"); Console.WriteLine("4. Plowed field"); Console.WriteLine("5. Natural Field"); Console.WriteLine(); Console.WriteLine("Choose what you want to create"); Console.Write("> "); string input = Console.ReadLine(); switch (Int32.Parse(input)) { case 1: farm.AddGrazingField(new GrazingField()); Console.WriteLine("You created a new Grazing farm!"); Console.WriteLine("Press Enter to go to the main Menu"); Console.ReadLine(); break; case 2: farm.AddChickenHouse(new ChickenHouse()); Console.WriteLine("You created a new Chicken House!"); Console.WriteLine("Press Enter to go to the main Menu"); Console.ReadLine(); break; case 3: farm.AddDuckHouse(new DuckHouse()); Console.WriteLine("You created a new Duck House!"); Console.WriteLine("Press Enter to go to the main Menu"); Console.ReadLine(); break; case 4: farm.AddPlowedField(new PlowedField()); Console.WriteLine("You created a new Plowed Field"); Console.WriteLine("Press Enter to go to the main Menu"); Console.ReadLine(); break; case 5: farm.AddNaturalFields(new NaturalFields()); Console.WriteLine("You created a new Natural Field!"); Console.WriteLine("Press Enter to go to the main Menu"); Console.ReadLine(); break; } }
private static void NewMethod(Farm farm, string input) { switch (Int32.Parse(input)) { case 1: Console.WriteLine("\n\n\n"); Console.WriteLine("Success! Press return key to go back to main menu."); Console.ReadLine(); farm.AddGrazingField(new GrazingField()); break; case 2: Console.WriteLine("\n\n\n"); Console.WriteLine("Success! Press return key to go back to main menu."); Console.ReadLine(); farm.AddPlowedField(new PlowedField()); break; case 3: farm.AddNaturalFields(new NaturalField()); Console.WriteLine("\n\n\n"); Console.WriteLine("Success! You have created a natural field!"); Console.WriteLine("Press return key to go back to main menu."); Console.Write(">"); Console.ReadLine(); break; case 4: Console.WriteLine("\n\n\n"); Console.WriteLine("Success! Press return key to go back to main menu."); Console.ReadLine(); farm.AddChickenHouse(new ChickenHouse()); break; case 5: Console.WriteLine("\n\n\n"); Console.WriteLine("Success! Press return key to go back to main menu."); Console.ReadLine(); farm.AddDuckHouse(new DuckHouse()); break; default: break; } }