예제 #1
0
        static void Main(string[] args)
        {
            try
            {
                string[] pizzaData = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
                string   name      = pizzaData[1];



                string[] doughData      = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
                string   flour          = doughData[1];
                string   bakingTehnique = doughData[2];
                int      weight         = int.Parse(doughData[3]);

                Dough dough = new Dough(flour, bakingTehnique, weight);
                Pizza pizza = new Pizza(name, dough);


                string[] toppingData = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
                while (toppingData[0] != "END")
                {
                    string toppingType   = toppingData[1];
                    int    toppingWeight = int.Parse(toppingData[2]);

                    Topping topping = new Topping(toppingType, toppingWeight);
                    pizza.Add(topping);

                    toppingData = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
                }

                Console.WriteLine(pizza);
            }
            catch (Exception ae)
            {
                Console.WriteLine(ae.Message);
            }
        }
예제 #2
0
 public Pizza(string name, Dough dough)
 {
     Name     = name;
     Dough    = dough;
     Toppings = new List <Topping>();
 }