示例#1
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            Console.WriteLine(beverage.getDescription()
                              + " $" + beverage.cost());

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine(beverage2.getDescription()
                              + " $" + beverage2.cost());

            Beverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine(beverage3.getDescription()
                              + " $" + beverage3.cost());

            Console.ReadKey();
        }
示例#2
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());
        }
示例#3
0
        static void Main(string[] args)
        {
            IBeverage beverage = new Espresso();

            Console.WriteLine(beverage.getDescription() + " $" + beverage.cost());

            IBeverage beverage2 = new DarkRoast();

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

            Console.WriteLine(beverage2.getDescription() + " $" + beverage2.cost());
        }
示例#4
0
        static void Main(string[] args)
        {
            Beverage espresso = new Espresso();
            Console.WriteLine(espresso.getDescription()+ " $" + espresso.cost());

            Beverage houseBlend = new HouseBlend();
            houseBlend = new Mocha(houseBlend);
            houseBlend= new Mocha(houseBlend);
            houseBlend = new Soy(houseBlend);
            Console.WriteLine(houseBlend.getDescription() + " $" + houseBlend.cost());

            Console.ReadLine();
        }
示例#5
0
        static void Main(string[] args)
        {
            Beverage espresso = new Espresso();

            Console.WriteLine(espresso.getDescription() + " $" + espresso.cost());

            Beverage houseBlend = new HouseBlend();

            houseBlend = new Mocha(houseBlend);
            houseBlend = new Mocha(houseBlend);
            houseBlend = new Soy(houseBlend);
            Console.WriteLine(houseBlend.getDescription() + " $" + houseBlend.cost());

            Console.ReadLine();
        }