Beispiel #1
0
    public static void Main()
    {
        Pizza pizza = new Pizza();

        try
        {
            var name = Console.ReadLine().Substring(6);
            pizza.Name = name;
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            return;
        }

        try
        {
            input = Console.ReadLine().Split();
            type  = input[1].ToLower();
            var technique = input[2].ToLower();
            quantity = Convert.ToDouble(input[3]);
            var dough = new Dough(type, technique, quantity);
            pizza.Dough = dough;
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            return;
        }

        input = Console.ReadLine().ToLower().Split();

        while (input[0] != "end")
        {
            try
            {
                type     = input[1];
                quantity = Convert.ToDouble(input[2]);
                var topping = new Topping(type, quantity);
                pizza.Add(topping);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }
            input = Console.ReadLine().ToLower().Split();
        }

        Console.WriteLine($"{pizza.Name} - {pizza.TotalCalories():F2} Calories.");
    }
Beispiel #2
0
    static void Main(string[] args)
    {
        //        Pizza Meatless
        //Dough Wholegrain Crispy 100
        //Topping Veggies 50
        //Topping Cheese 50
        //END

        Pizza pizza;
        Dough dough;

        try
        {
            string[] pizzaInfo = Console.ReadLine().Split();
            string   pizzaName = pizzaInfo[1];
            pizza = new Pizza(pizzaName);

            string[] doughInfo  = Console.ReadLine().Split();
            string   flour      = doughInfo[1];
            string   bakingTech = doughInfo[2];
            double   weight     = double.Parse(doughInfo[3]);
            dough = new Dough(flour.ToLower(), bakingTech.ToLower(), weight);

            pizza.PizzaDough = dough;

            string toppingInfo;

            while ((toppingInfo = Console.ReadLine()) != "END")
            {
                string[] toppingParams = toppingInfo.Split();

                string  toppingName   = toppingParams[1].ToLower();
                double  toppingWeight = double.Parse(toppingParams[2]);
                Topping topping       = new Topping(toppingName, toppingWeight);

                pizza.Add(topping);
            }

            Console.WriteLine($"{pizza.Name} - {pizza.PizzaCalories():f2} Calories.");
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
            return;
        }
    }
Beispiel #3
0
        public void Run()
        {
            var   pizzaInfo = Console.ReadLine().Split();
            Pizza pizza     = new Pizza(pizzaInfo[1]);
            var   doughInfo = Console.ReadLine().Split();
            Dough dough     = new Dough(doughInfo[1], doughInfo[2], double.Parse(doughInfo[3]));

            pizza.Dough = dough;

            string toppings;

            while ((toppings = Console.ReadLine()) != "END")
            {
                var     toppingsInfo = toppings.Split();
                Topping topping      = new Topping(toppingsInfo[1], double.Parse(toppingsInfo[2]));
                pizza.Add(topping);
            }
            Console.WriteLine($"{pizza.Name} - {pizza.TotalCalories:f2} Calories.");
        }
Beispiel #4
0
 public void AddMushrooms(Pizza pizza)
 {
     pizza.Add("Mushroom");
 }
Beispiel #5
0
 public void AddSausage(Pizza pizza)
 {
     pizza.Add("Sausage");
 }
Beispiel #6
0
 public void AddPepperoni(Pizza pizza)
 {
     pizza.Add("Pepperoni");
 }
Beispiel #7
0
 public void AddChicken(Pizza pizza)
 {
     pizza.Add("Chicken");
 }
 public void SpreadSauce(Pizza pizza)
 {
     pizza.Add("Classic Sauce");
 }
Beispiel #9
0
 public void AddOlives(Pizza pizza)
 {
     pizza.Add("Spanish Arbequina");
 }
 public void AddCheese(Pizza pizza)
 {
     pizza.Add("Basic Cheese");
 }
Beispiel #11
0
 public void SpreadSauce(Pizza pizza)
 {
     pizza.Add("Artisan sauce");
 }
Beispiel #12
0
 public void RollDough(Pizza pizza)
 {
     pizza.Add("Artisan dough");
 }
Beispiel #13
0
 public void AddCheese(Pizza pizza)
 {
     pizza.Add("Artisan cheese");
 }
Beispiel #14
0
 public void AddPeppers(Pizza pizza)
 {
     pizza.Add("Padon Pepper");
 }
Beispiel #15
0
 public void AddOlives(Pizza pizza)
 {
     pizza.Add("Black olives");
 }
 public void RollDough(Pizza pizza)
 {
     pizza.Add("Classic Dough");
 }
Beispiel #17
0
 public void AddPeppers(Pizza pizza)
 {
     pizza.Add("Green peppers");
 }
Beispiel #18
0
 public void AddMushrooms(Pizza pizza)
 {
     pizza.Add("Fungus d'jour");
 }