Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            PrintBeverageCost(beverage);

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            PrintBeverageCost(beverage2);

            Beverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            PrintBeverageCost(beverage3);

            Beverage beverage4 = new Decaf();

            beverage4 = new Latte(beverage4);
            beverage4 = new Mocha(beverage4);
            beverage4 = new Whip(beverage4);
            PrintBeverageCost(beverage4);

            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            ICoffee latte = new Latte();

            latte = new WhippedCream(latte);
            latte = new Caramel(latte);
            latte = new SoyMilk(latte);
            Console.WriteLine(latte.ShowInfo());
            Console.WriteLine();

            ICoffee espresso = new Espresso();

            Console.WriteLine(espresso.ShowInfo());
            Console.WriteLine();

            ICoffee cappuccino = new Cappuccino();

            cappuccino = new SoyMilk(cappuccino);
            cappuccino = new Caramel(cappuccino);
            Console.WriteLine(cappuccino.ShowInfo());
        }