Example #1
0
        public void RemoveTopping(string topName)
        {
            Topping topping = null;

            foreach (Topping top in Toppings)
            {
                if (top.TopName == topName)
                {
                    topping = top;
                    break;
                }
            }

            Toppings.Remove(topping);
        }
Example #2
0
 void AddToppings(Toppings topping)
 {
     toppings.Add(topping);
 }
 public void AddTopping(Toppings topping)
 {
     _toppings.Add(topping);
 }
Example #4
0
 // methods
 void AddToppings(string topping)
 {
     Toppings.Add(topping);
 }
 public override string ToString()
 {
     return($"{Name}, {Size.Name}, {Crust.Name} ----- {CalculatePrice().ToString("C2")}\n" +
            $"Toppings: {string.Join(", ", Toppings.Select(topping => topping.Name).ToArray())}");
 }
 public decimal CalculatePrice()
 {
     return(Size.Price + Crust.Price + Toppings.Sum(topping => topping.Price));
 }
 public void AddToppings(List <Topping> toppings)
 {
     Toppings.AddRange(toppings);
 }
 public void AddTopping(Topping topping)
 {
     Toppings.Add(topping);
 }
 // for creating presets
 public Pizza(string name, List <Topping> toppings)
 {
     Name = name;
     Toppings.AddRange(toppings);
 }