static void Main() { var input = Console.ReadLine() .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); try { while (!input[0].Equals("END")) { switch (input[0]) { case "Pizza": Pizza pizza = CreatePizza(input); Console.WriteLine($"{pizza.Name} - {pizza.TotalCalories():F2} Calories."); break; case "Dough": Dough dough = CreateDough(input); Console.WriteLine($"{dough.GetTotalCalories():F2}"); break; case "Topping": Topping topping = CreateTopping(input); Console.WriteLine($"{topping.GetTotalCalories():F2}"); break; } input = Console.ReadLine() .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } }