static void Main(string[] args) { Pizza pizza = new LargePizza(); pizza = new Cheese(pizza); pizza = new Ham(pizza); Console.WriteLine($"{pizza.GetDescription()} that have a cost of {pizza.CalculateCost()}"); }
static void Main(string[] args) { Pizza largePizza = new LargePizza(); largePizza = new Cheese(largePizza); largePizza = new Ham(largePizza); largePizza = new Pepper(largePizza); Console.WriteLine(largePizza.GetDescription()); Console.WriteLine($"Cost: {largePizza.CalculateCost():C2}"); }
static void Main(string[] args) { Pizza largePizza = new LargePizza(); largePizza = new Cheese(largePizza); largePizza = new Ham(largePizza); largePizza = new Peppers(largePizza); Console.WriteLine($"Pizza with toppings: {largePizza.GetDescription()}"); Console.WriteLine($"Price {largePizza.CalculateCost()} Dollars"); }
public void Run() { Pizza pizzaLarge = new LargePizza(); pizzaLarge = new Cheese(pizzaLarge); pizzaLarge = new Ham(pizzaLarge); pizzaLarge = new Pepper(pizzaLarge); Console.WriteLine(pizzaLarge.GetDescription()); Console.WriteLine($"Cost: {pizzaLarge.CalculateCost()}"); Console.ReadKey(); }
static void Main(string[] args) { Pizza largePizza = new LargePizza(); largePizza = new Cheese(largePizza); largePizza = new Ham(largePizza); Console.WriteLine(largePizza.GetDescription()); Console.WriteLine("{0:C2}", largePizza.CalculateCost()); Console.ReadKey(); }
static void Main(string[] args) { Pizza largePizza = new LargePizza(); //decorators taking the old pizza class largePizza = new Cheese(largePizza); largePizza = new Ham(largePizza); largePizza = new Peppers(largePizza); string accountNumber = "0000228010000228"; Console.WriteLine(accountNumber.Substring(2, 6)); Console.WriteLine(accountNumber.Substring(0, 6) + "xxxxxx" + accountNumber.Substring(12, 4)); Console.WriteLine(largePizza.GetDesription()); Console.WriteLine("{0:C2}", largePizza.CalculateCost()); Console.ReadKey(); }