Exemplo n.º 1
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");
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
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();
        }