示例#1
0
        private static void Main(string[] args)
        {
            //regularPizzaBase.Print();
            //italianPizzaBase.Print();
            //thickPizzaBase.Print();

            //var list = new List<PizzaTopping>();

            //list.Add(new PizzaTopping("Meat", 10));
            //list.Add(new PizzaTopping("Meat", 15));
            //list.Add(new PizzaTopping("Cheese", 15));

            //var pizza = new Pizza("P1", thickPizzaBase, list);

            //pizza.Print();

            //list.Add(new PizzaTopping("Vegetables", 20));

            var regularPizzaBase = new PizzaBase("Regular", 10);
            var italianPizzaBase = new PizzaBase("Italian", 10);
            var thickPizzaBase   = new PizzaBase("Thick", 10);

            var pizza1 = new Pizza("Pizza 1", regularPizzaBase);

            pizza1.AddTopping(new PizzaTopping("Meat", 10));
            pizza1.AddTopping(new PizzaTopping("Cheese", 5));

            var pizza2 = new Pizza("Pizza 2", italianPizzaBase);

            pizza2.AddTopping(new PizzaTopping("Meat", 10));
            pizza2.AddTopping(new PizzaTopping("Cheese", 5));

            pizza1.Print();
            pizza2.Print();

            Console.ReadLine();
        }
示例#2
0
 public Pizza(PizzaBase pBase, string name)
 {
     this.PizzaBase    = pBase;
     this.PizzaTopping = new List <PizzaTopping>();
     this.Name         = name;
 }
示例#3
0
文件: Pizza.cs 项目: Humaniuc/POOWs
 internal Pizza(string name, PizzaBase pbase)
 {
     Name   = name;
     PizzaB = pbase;
 }
示例#4
0
 public Pizza(string name, PizzaBase pizzaBase)
 {
     Name = name;
     Base = pizzaBase;
 }
示例#5
0
 public Pizza(PizzaBase pizzaBase, string name)
 {
     this.pizzaBase     = pizzaBase;
     this.name          = name;
     this.pizzaToppings = new List <PizzaTopping>();
 }
示例#6
0
 public Pizza(PizzaBase pizzaBase)
 {
     this.PizzaBase    = pizzaBase;
     this.PizzaTopping = new List <PizzaTopping>();
 }
示例#7
0
        static void Main()
        {
            PizzaBase bazaPizza1 = new PizzaBase("Regular")
            {
                Cost = 22.10
            };
            PizzaBase bazaPizza2 = new PizzaBase("Italian")
            {
                Cost = 18.10
            };
            PizzaBase bazaPizza3 = new PizzaBase("Thick")
            {
                Cost = 25.10
            };

            //Console.WriteLine("\n {0} \n {1} \n {2}",bazaPizza1.Print (), bazaPizza2.Print (), bazaPizza3.Print ());

            PizzaTopping topping1 = new PizzaTopping()
            {
                Name = "Ciuperci", Cost = 2.5
            };
            PizzaTopping topping2 = new PizzaTopping()
            {
                Name = "Rosii", Cost = 2.5
            };
            PizzaTopping topping3 = new PizzaTopping()
            {
                Name = "Ardei gras", Cost = 2.5
            };
            PizzaTopping topping4 = new PizzaTopping()
            {
                Name = "Ceapa rosie", Cost = 2.5
            };

            PizzaTopping topping5 = new PizzaTopping()
            {
                Name = "Piept de curcan".ToUpper(), Cost = 4.5
            };
            PizzaTopping topping6 = new PizzaTopping()
            {
                Name = "Prosiciutto".ToUpper(), Cost = 4.5
            };
            PizzaTopping topping7 = new PizzaTopping()
            {
                Name = "Piept de pui".ToUpper(), Cost = 4.5
            };

            PizzaTopping topping8 = new PizzaTopping()
            {
                Name = "Gorgonzola", Cost = 3.5
            };
            PizzaTopping topping9 = new PizzaTopping()
            {
                Name = "Mozzarella", Cost = 3.5
            };
            PizzaTopping topping10 = new PizzaTopping()
            {
                Name = "Grana Padano", Cost = 3.5
            };

            //Console.WriteLine("\n {0} \n {1} \n {2}",topping1.Print (), topping2.Print (), topping3.Print ());

            Pizza pizza1 = new Pizza()
            {
                numeBaza = bazaPizza1.Name, costBaza = bazaPizza1.Cost
            };

            pizza1.AddPizza("Espagnola");
            pizza1.pizzaToppings.Add(topping1);
            pizza1.pizzaToppings.Add(topping2);
            pizza1.pizzaToppings.Add(topping6);
            pizza1.pizzaToppings.Add(topping9);

            Pizza pizza2 = new Pizza()
            {
                numeBaza = bazaPizza2.Name, costBaza = bazaPizza2.Cost
            };

            pizza2.AddPizza("Verona");
            pizza2.pizzaToppings.Add(topping3);
            pizza2.pizzaToppings.Add(topping4);
            pizza2.pizzaToppings.Add(topping5);
            pizza2.pizzaToppings.Add(topping8);

            Pizza pizza3 = new Pizza()
            {
                numeBaza = bazaPizza3.Name, costBaza = bazaPizza3.Cost
            };

            pizza3.AddPizza("Florenta");
            pizza3.pizzaToppings.Add(topping2);
            pizza3.pizzaToppings.Add(topping3);
            pizza3.pizzaToppings.Add(topping7);
            pizza3.pizzaToppings.Add(topping10);

            Console.WriteLine("\n");
            pizza1.Print();
            Console.WriteLine("\n");
            pizza2.Print();
            Console.WriteLine("\n");
            pizza3.Print();

            Console.ReadLine();
        }
示例#8
0
 public Pizza(string PizzaName, PizzaBase blat)
 {
     this.Name      = PizzaName;
     this.pizzaBase = blat;
     sum           += blat.Cost;
 }
示例#9
0
 public Pizza(PizzaBase basePizza)
 {
     this.pizzaBase = basePizza;
 }
示例#10
0
 public Pizza(string name, PizzaBase baseOfPizza, List <PizzaTopping> listOfTopp)
 {
     this.Name          = name;
     this.PizzaBase     = baseOfPizza;
     this.PizzaToppings = listOfTopp;
 }
示例#11
0
 public Pizza(PizzaBase pb)
 {
     this.Name         = Name;
     this.PizzaBase    = pb;
     this.PizzaTopping = new List <PizzaTopping>();
 }
示例#12
0
 public Pizza(string PizzaName, PizzaBase crust)
 {
     this.Name      = PizzaName;
     this.pizzabase = crust;
     Total         += crust.ExtraCost;
 }