Example #1
0
        static void Main(string[] args)
        {
            Espresso espresso = new Espresso();

            Console.WriteLine(espresso.getDescription() + " Cost: " + espresso.Cost());

            Beverage doubleMochaWhipEspresso = new Mocha(new Mocha(new Whip(espresso)));

            Console.WriteLine(doubleMochaWhipEspresso.getDescription() + " Cost: " + doubleMochaWhipEspresso.Cost());
        }
Example #2
0
        static void Main()
        {
            Beverage houseBlend = new HouseBlend();

            houseBlend.BeverageSize = Beverage.Size.Grande;
            houseBlend = new Soy(houseBlend);
            houseBlend = new Mocha(houseBlend);
            houseBlend = new Mocha(houseBlend);

            WriteLine($"{houseBlend.GetDescription()} : {houseBlend.Cost()}");
        }
Example #3
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            beverage = new Mocha(beverage);
            beverage = new Mocha(beverage);
            beverage = new Mocha(beverage);

            Console.WriteLine(beverage.Cost());
            Console.ReadLine();
        }
Example #4
0
        static void Main(string[] args)
        {
            Coffe coffe = new Expresso();   // Recursion is the fact behind. which keeps track of the encapsulated objects.

            coffe = new Mocha(coffe);       // In this line coffe = Mocha at runtime.
            coffe = new Milk(coffe);        // In this line coffe = Milk  at runtime.
            coffe = new Mocha(coffe);       // In this line coffe = Mocha at runtime.

            Console.WriteLine("Ingredients: " + coffe.GetDescription());
            Console.WriteLine("Total Cost: " + coffe.Cost());
        }
Example #5
0
        static void Main(string[] args)
        {
            var beverage = new Espresso();

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

            Beverage beverage2 = new HouseBlend();

            beverage2 = new Mocha(beverage2);
            Console.WriteLine(beverage2.GetDescription() + " $" + beverage2.Cost());
        }
        static void Main(string[] args)
        {
            Beverage espresso = new Espresso();

            System.Console.WriteLine(espresso.GetDescription() + "   -   " + espresso.Cost());

            Beverage espressoMocha = new Mocha(espresso);

            System.Console.WriteLine(espressoMocha.GetDescription() + "   -   " + espressoMocha.Cost());

            System.Console.ReadLine();
        }
Example #7
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            Console.WriteLine($"{beverage.GetDescription()} ${beverage.Cost()}");

            Beverage beverage2 = new HouseBlend();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            Console.WriteLine($"{beverage2.GetDescription()} ${beverage2.Cost()}");

            Console.ReadKey();
        }
Example #8
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            beverage = new Mocha(beverage);
            Console.WriteLine(beverage.GetDescription() + "$" + beverage.Cost());

            Beverage beverage1 = new HouseBlend();

            beverage1 = new Mocha(beverage1);
            //beverage1 = new Mocha(beverage1);
            //beverage1 = new Soy(beverage1);
            //beverage1 = new Soy(beverage1);
            Console.WriteLine(beverage1.GetDescription() + "$" + beverage1.Cost());
        }
        static void Main(string[] args)
        {
            Console.WriteLine("We have these fabulous drinkings.");

            Beverage espresso    = new Espresso();
            Beverage latte       = new Latte();
            Beverage orangejuice = new OrangeJuice();

            Console.WriteLine($"Espresso : {espresso.Description} \\.{espresso.Cost()}");
            Console.WriteLine($"Latte : {espresso.Description} \\.{latte.Cost()}");
            Console.WriteLine($"OrangeJuice : {espresso.Description} \\.{orangejuice.Cost()}");

            Beverage mochaLatte = new Mocha(new Latte());

            Console.WriteLine($"Mocha Latte : {mochaLatte.Description} \\.{mochaLatte.Cost()}");

            Console.ReadLine();
        }
Example #10
0
        static void Main(string[] args)
        {
            Beverage coffee = new Latte();

            Console.WriteLine("Current coffee is: {0}, cost is {1}.", coffee.GetDescription(), coffee.Cost());

            Beverage latteWithMilk         = new Milk(coffee);
            Beverage latteWithMilkAndMocha = new Mocha(latteWithMilk);

            Console.WriteLine("Current coffee is: {0}, cost is {1}.", latteWithMilkAndMocha.GetDescription(), latteWithMilkAndMocha.Cost());

            Beverage latteWithMilkAndDoubleMocha = new Mocha(latteWithMilkAndMocha);

            Console.WriteLine("Current coffee is: {0}, cost is {1}.", latteWithMilkAndDoubleMocha.GetDescription(), latteWithMilkAndDoubleMocha.Cost());
        }
Example #11
0
        static void Main(string[] args)
        {
            Beverage CaramelEspresso = new Mocha(new Caramel(new Espresso()));

            Console.WriteLine(CaramelEspresso.Cost());
        }