Example #1
0
        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()}");
        }
Example #2
0
        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}");
        }
Example #3
0
        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");
        }
Example #4
0
        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();
        }
Example #5
0
        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();
        }
Example #6
0
        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();
        }
Example #7
0
        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();
        }