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

            Console.WriteLine(beverage.Description + " $" + beverage.Cost());

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine(beverage2.Description + " $" + beverage2.Cost());

            Beverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine(beverage3.Description + " $" + beverage3.Cost());
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            Console.WriteLine(string.Format("{0} ${1}", beverage.GetDescription(), beverage.Cost()));

            Beverage beverage2 = new DarkRoast();

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

            Console.WriteLine(string.Format("{0} ${1}", beverage2.GetDescription(), beverage2.Cost()));

            Beverage beverage3 = new HouseBlend();

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

            Console.WriteLine(string.Format("{0} ${1}", beverage3.GetDescription(), beverage3.Cost()));
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            IBaverage espresso = new Espresso();

            Console.WriteLine($"{espresso.Name()} = ${espresso.Cost()}");
            Console.WriteLine("------------------------------------------------------------------");
            IBaverage houseBlend = new HouseBlend();

            Console.WriteLine($"{houseBlend.Name()} = ${houseBlend.Cost()}");
            Console.WriteLine("------------------------------------------------------------------");
            IBaverage houseBlendWithMocha = new HouseBlend();

            houseBlendWithMocha = new Mocha(houseBlendWithMocha);
            Console.WriteLine($"{houseBlendWithMocha.Name()} = ${houseBlendWithMocha.Cost()}");
            Console.WriteLine("------------------------------------------------------------------");
            IBaverage darkRosatedWithMochaAndSteamedMilk = new DarkRoast();

            darkRosatedWithMochaAndSteamedMilk = new Mocha(darkRosatedWithMochaAndSteamedMilk);
            darkRosatedWithMochaAndSteamedMilk = new SteamedMilk(darkRosatedWithMochaAndSteamedMilk);
            Console.WriteLine($"{darkRosatedWithMochaAndSteamedMilk.Name()} = ${darkRosatedWithMochaAndSteamedMilk.Cost()}");
            Console.WriteLine("------------------------------------------------------------------");
        }