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

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

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocah(beverage2);
            beverage2 = new Mocah(beverage2);
            beverage2 = new Whip(beverage2);

            Console.WriteLine(beverage2.GetDescription() + "$" + beverage2.Cost());
            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

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

            Beverage beverage2 = new HouseBlend();

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

            Console.ReadKey();
        }
예제 #3
0
        static void Main(string[] args)
        {
            var espresso = new Espresso();

            Console.WriteLine(espresso.GetDescription());
            Console.WriteLine(espresso.Cost());
            var espressoWithChoc = new HotChocolate(espresso);

            Console.WriteLine(espressoWithChoc.GetDescription());
            Console.WriteLine(espressoWithChoc.Cost());
            var espressoWithChockAndDoubleSyrop =
                new MapleSyrup(new MapleSyrup(espressoWithChoc));

            Console.WriteLine(espressoWithChockAndDoubleSyrop.GetDescription());
            Console.WriteLine(espressoWithChockAndDoubleSyrop.Cost());
        }
예제 #4
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

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

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

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

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

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

            Console.ReadKey();
        }
예제 #5
0
        static void Main()
        {
            Beverage beverage = new Espresso("tall");

            beverage = new Mocha(beverage);
            beverage = new Soy(beverage);
            Console.WriteLine(beverage.Description() + " = " + beverage.Cost());

            Beverage beverage2 = new Espresso("tadll");
            beverage2 = new Mocha(beverage2);
            beverage2 = new Soy(beverage2);

            Console.WriteLine(beverage2.Description() + " = " + beverage2.Cost());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
예제 #6
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            Console.WriteLine($"{beverage.getDescription()} ${beverage.cost()}");
            Beverage beverageEspresso = new Espresso();

            beverageEspresso = new Mocha(beverageEspresso);
            beverageEspresso = new Mocha(beverageEspresso);
            beverageEspresso = new Whip(beverageEspresso);
            Console.WriteLine($"{beverageEspresso.getDescription()} ${beverageEspresso.cost()}");
            Beverage beverageHouseBlend = new HouseBlend();

            beverageHouseBlend = new Mocha(beverageHouseBlend);
            beverageHouseBlend = new Mocha(beverageHouseBlend);
            beverageHouseBlend = new Whip(beverageHouseBlend);
            Console.WriteLine($"{beverageHouseBlend.getDescription()} ${beverageHouseBlend.cost()}");
            Console.ReadKey();
        }
예제 #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Beverage espresso = new Espresso();

            Console.WriteLine(espresso.Description + " costs: " + espresso.cost());

            Beverage beverage = new DarkRoast();

            Console.WriteLine(beverage.Description + " costs: " + beverage.cost());
            beverage = new Mocha(beverage);
            Console.WriteLine(beverage.Description + " costs: " + beverage.cost());
            beverage = new Soy(beverage);
            Console.WriteLine(beverage.Description + " costs: " + beverage.cost());
            beverage = new Whip(beverage);
            Console.WriteLine(beverage.Description + " costs: " + beverage.cost());

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

            Console.WriteLine(beverage);

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine(beverage2);

            Beverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine(beverage3);
        }
예제 #9
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            beverage.display();

            Beverage beverage2 = new DarkRoast();

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

            Beverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            beverage3.display();
        }
예제 #10
0
        static void Main(string[] args)
        {
            Beverage beverage = new HouseBlend();

            Console.WriteLine(beverage.ToString());

            // dark roast with double mocha and whip
            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Milk(beverage2);
            Console.WriteLine(beverage2.ToString());

            // espresso with milk
            Beverage beverage3 = new Espresso();

            beverage3 = new Milk(beverage3);
            Console.WriteLine(beverage3.ToString());
        }
예제 #11
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());
        }
예제 #12
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()}");
        }
예제 #13
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());
        }
        public static void MakeSomeCoffee()
        {
            Beverage beverage = new Espresso();

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

            Beverage darkRoast = new DarkRoast();

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

            Beverage houseBlend = new HouseBlend();

            houseBlend.SetSize(Size.VENTI);
            houseBlend = new Soy(houseBlend);
            houseBlend = new Mocha(houseBlend);
            houseBlend = new Whip(houseBlend);
            Console.WriteLine($"{houseBlend.GetDescription()} ${houseBlend.Cost()}");
        }
예제 #15
0
        static void Main(string[] args)
        {
            BeverageBase espresso = new Espresso();

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

            BeverageBase houseBlend = new HouseBlend();

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

            BeverageBase darkRoast = new DarkRoast();

            darkRoast = new SoyMilk(darkRoast);
            darkRoast = new Mocha(darkRoast);
            darkRoast = new WhipCream(darkRoast);
            Console.WriteLine($"{darkRoast.GetDescription()} ${darkRoast.Cost()}");

            Console.ReadLine();
        }
예제 #16
0
파일: Program.cs 프로젝트: JvPost/DP
        static void Main(string[] args)
        {
            Beverage bev1 = new Espresso();

            Print(bev1);

            Beverage bev2 = new DarkRoast();

            bev2 = new Mocha(bev2);
            bev2 = new Mocha(bev2);
            bev2 = new Whip(bev2);
            Print(bev2);

            Beverage bev3 = new HouseBlend();

            bev3 = new Soy(bev3);
            bev3 = new Mocha(bev3);
            bev3 = new Whip(bev3);
            Print(bev3);

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

            Console.WriteLine("Description: {0} \r\n Coast: {1}", beverage.GetDescription(), beverage.Coast());

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine("Description: {0} \r\n Coast: {1}", beverage2.GetDescription(), beverage2.Coast());

            Beverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine("Description: {0} \r\n Coast: {1}", beverage3.GetDescription(), beverage3.Coast());

            Console.ReadKey();
        }
예제 #18
0
        static void Main()
        {
            Console.WriteLine();

            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());
        }
예제 #19
0
        static void Main(string[] args)
        {
            Beverage beverage1 = new Espresso();

            Console.WriteLine("{0} costs {1}$", beverage1.GetDescription(), beverage1.cost());

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Milk(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            beverage2.GetDescription();
            Console.WriteLine("{0} costs {1}$", beverage2.GetDescription(), beverage2.cost());

            Beverage beverage3 = new Decaf();

            beverage3.setSize(Beverage.Size.Venti);
            beverage3 = new Soy(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine("{0} costs {1}$", beverage3.GetDescription(), beverage3.cost());

            Console.ReadLine();
        }
예제 #20
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

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

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

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

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

            beverage.size = Size.Larger;
            Console.WriteLine(beverage.GetDescription() + " $ " + beverage.Cost());

            beverage.size = Size.Middle;
            Console.WriteLine(beverage.GetDescription() + " $ " + beverage.Cost());

            beverage.size = Size.Small;
            Console.WriteLine(beverage.GetDescription() + " $ " + beverage.Cost());
        }
예제 #21
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("woof!");

            Beverage my_bev = new Espresso(Beverage.bev_size.VENTI);
            System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]");
            System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]");

            my_bev = new Mocha(my_bev);
            System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]");
            System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]");
            
            my_bev = new Mocha(my_bev);
            System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]");
            System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]");

            my_bev = new Soy(my_bev);
            System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]");
            System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]");

            my_bev = new Whip(my_bev);
            System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]");
            System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]");

            my_bev = new Whip(my_bev);
            System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]");
            System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]");

        }
예제 #22
0
파일: Program.cs 프로젝트: rhdlmv/Jimi
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();
            Console.WriteLine(beverage.GetDescription() + "$" + beverage.cost().ToString());

            Beverage beverage2 =  new DarkRoast();
            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);//用两个Mocha修饰
            beverage2 = new Whip(beverage2);//在用Whip修饰。
            Console.WriteLine(beverage2.GetDescription() + "$" + beverage2.cost().ToString());
            Console.ReadKey();
        }