public override void AddTopping(ToppingsList topping) { switch (topping) { case ToppingsList.Sugar: Toppings.Add(new Sugar()); break; case ToppingsList.Milk: case ToppingsList.Chocolate: throw new InvalidOperationException($"Illegal topping for {Description}: {topping}"); default: throw new InvalidOperationException($"Unknown topping: {topping}"); } }
private string GenerateDesciption() { string description = Size + " Inch pizza " + Crust + " "; if (Toppings != null && ToppingsList.Count() > 0) { description += "with toppings: "; description += String.Join(", ", ToppingsList); } if (Cheese) { description += " with cheese"; } else { description += " without cheese"; } description += " and " + Sauce + " sauce."; return(description); }
public abstract void AddTopping(ToppingsList topping);
public void AddTopping(Topping topping) { ToppingsList.Add(topping); }
protected virtual void AddTopping(decimal p, int i, APizzaComponent apc) { ToppingsList.Add(new Topping(this, p, i, apc)); }
protected virtual void AddTopping(decimal p, int i, string n, ItemType t) { ToppingsList.Add(new Topping(this, p, i, n, t)); }
protected virtual void AddTopping(string type, decimal price) { ToppingsList.Add(new Topping(type, price)); }