private static double TakeModifierToBack(Dough dough)
        {
            switch (dough.FlourType.ToLower())
            {
                case "white":
                    return 1.5;
                case "wholegrain":
                    return 1.0;
            }

            return 0;
        }
        private static double TakeModifierToFloor(Dough dough)
        {
            switch (dough.BackType)
            {
                case "crispy":
                    return 0.9;
                case "chewy":
                    return 1.1;
                case "homemade":
                    return 1.0;
            }

            return 0;
        }
Ejemplo n.º 3
0
 public Pizza(string name, Dough dough)
 {
     this.Name     = name;
     this.dough    = dough;
     this.toppings = new List <Topping>();
 }
Ejemplo n.º 4
0
 public Pizza(string nameInput, Dough doughInput, List <Topping> listToppingInput)
 {
     this.Name        = nameInput;
     this.Dough       = doughInput;
     this.ListTopping = listToppingInput;
 }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            var info = Console.ReadLine();


            while (info != "END")
            {
                var split = info.Split(new[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);


                if (split[0].ToLower() == "dough")
                {
                    try
                    {
                        var type         = split[1];
                        var bakingMethod = split[2];
                        var weigth       = double.Parse(split[3]);

                        var dough = new Dough(type, bakingMethod, weigth);
                        Console.WriteLine($"{dough.CalculateCalories():f2}");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        return;
                    }
                }
                else if (split[0].ToLower() == "topping")
                {
                    try
                    {
                        var type   = split[1].ToLower();
                        var weigth = double.Parse(split[2]);

                        var top = new Topping(type, weigth);
                        Console.WriteLine($"{top.CalculateCalories():f2}");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        return;
                    }
                }
                else if (split[0].ToLower() == "pizza")
                {
                    var pizzaName     = split[1];
                    var numOfToppings = int.Parse(split[2]);
                    if (numOfToppings > 10)
                    {
                        Console.WriteLine("Number of toppings should be in range [0..10].");
                        return;
                    }


                    var doughInfo = Console.ReadLine().Split(new[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);

                    Pizza pizza;

                    try
                    {
                        var dough = new Dough(doughInfo[1].ToLower(), doughInfo[2].ToLower(), double.Parse(doughInfo[3]));
                        pizza = new Pizza(pizzaName, dough);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        return;
                    }
                    for (int i = 0; i < numOfToppings; i++)
                    {
                        var topings = Console.ReadLine().Split(new[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);

                        try
                        {
                            var toping = new Topping(topings[1], double.Parse(topings[2]));
                            pizza.Toping.Add(toping);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            return;
                        }
                    }
                    Console.WriteLine($"{pizza.Name} - {pizza.TotalCalories():F2} Calories.");
                    return;
                }


                info = Console.ReadLine();
            }
        }
Ejemplo n.º 6
0
 public Pizza(string name, Dough dough)
 {
     this.Name   = name;
     this.Toping = new List <Topping>();
     this.Dough  = dough;
 }
 public Pizza(string name, Dough dough)
 {
     this.Name  = name;
     this.dough = dough;
 }
Ejemplo n.º 8
0
 public Pizza(string name, Dough dough)
     : this()
 {
     Name       = name;
     this.dough = dough;
 }
Ejemplo n.º 9
0
 public Pizza(string name, Dough dough)
 {
     Name     = name;
     Dough    = dough;
     toppings = new List <Topping>();
 }