private static Topping CreateTopping(string command) { string[] toppingInfo = command .Split(" ", StringSplitOptions.RemoveEmptyEntries) .ToArray(); string toppingName = toppingInfo[1]; int toppingWeight = int.Parse(toppingInfo[2]); Topping topping = new Topping(toppingName, toppingWeight); return(topping); }
private void AddToppings(Pizza pizza) { string command = Console.ReadLine(); while (command != "END") { Topping topping = CreateTopping(command); pizza.AddTopping(topping); command = Console.ReadLine(); } }