Esempio n. 1
0
        private static void Main(string[] args)
        {
            Console.WriteLine("StarbuzzCoffe!");

            Beverage beverage = new Expresso();

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

            Beverage beverage1 = new DarkRoast();

            beverage1 = new Mocha(beverage1);
            beverage1 = new Mocha(beverage1);
            beverage1 = new Whip(beverage1);

            Console.WriteLine("Dark");
            Console.WriteLine($@"{beverage1.GetDescription()}, $ {beverage1.Cost()}");

            Beverage beverage2 = new HouseBlend();

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

            Console.WriteLine("HouseBlend");
            Console.WriteLine($@"{beverage2.GetDescription()}, $ {beverage2.Cost()}");

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

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

            Beverage beverage2 = new DarkRoast();

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

            Beverage beverage3 = new HouseBlend();

            beverage3.setBeverageSize(BeverageSize.BIG);
            beverage3 = new Soy(beverage3);
            beverage3.setBeverageSize(BeverageSize.BIG);
            beverage3 = new Mocha(beverage3);
            beverage3.setBeverageSize(BeverageSize.BIG);
            beverage3 = new Whip(beverage3);
            beverage3.setBeverageSize(BeverageSize.BIG);
            Console.WriteLine(beverage3.getDescription() + " $" + beverage3.cost());
            Console.ReadKey();
        }
Esempio n. 4
0
        private static void Main(string[] args)
        {
            //Test order

            //First of all we order espresso without condiments
            IBeverage beverage1 = new Espresso();

            Console.WriteLine(beverage1.Description + $" {beverage1.Cost()} $");

            //Second order - Dark Roast + Mocha x2 + Whip
            IBeverage beverage2 = new DarkRoast();

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

            //Third order - House Blend + Soy + Mocha + Whip
            IBeverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine(beverage3.Description + $" {beverage3.Cost()} $");

            //*A more elegant way to create decorated objects will be presented in the description of the factory pattern.
            Console.ReadKey();
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso(Size.Grande);

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

            Beverage beverage2 = new DarkRoast(Size.Venti);

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

            Beverage beverage3 = new HouseBlend(Size.Tall);

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

            Beverage beverage4 = new HouseBlend(Size.Grande);

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

            Console.ReadLine();
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            Baverage baverage = new DarkRoast("Какое-то кофе!");

            baverage = new Milk(baverage, "Молоко!");
            baverage = new Milk(baverage, "Молоко!");
            baverage = new Soy(baverage, "Soy!");
            Console.WriteLine(baverage.getDescription() + "=" + baverage.cost() + "$");
        }
Esempio n. 7
0
 static void Main(string[] args)
 {
     Beverage beverage = new Expresso();
     Print(beverage);
     Beverage beverage2 = new DarkRoast();
     beverage2 = new Mocha(beverage2);
     beverage2 = new Mocha(beverage2);
     beverage2 = new Whip(beverage2);
     Print(beverage2);
     Console.ReadKey(true);
 }
Esempio n. 8
0
        static void Main(string[] args)
        {
            Beverage beverage = new DarkRoast();

            Console.WriteLine("Drink name: {0}, cost: {1}eu", beverage.GetDescription(), beverage.Cost());

            Beverage beverage2 = new Expresso();

            beverage2 = new Milk(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine("Drink name: {0}, cost: {1}eu", beverage2.GetDescription(), beverage2.Cost());
        }
Esempio n. 9
0
        static void Main()
        {
            Beverage coffee = new DarkRoast(PortionSize.m);

            Console.WriteLine($"{coffee.Description}: ${coffee.Cost}");

            coffee = new Mocha(coffee);
            Console.WriteLine($"{coffee.Description}: ${coffee.Cost}");

            coffee = new Soy(coffee);
            Console.WriteLine($"{coffee.Description}: ${coffee.Cost}");
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            Console.WriteLine("The Decorator");
            Console.Write("This program show to you 2 example.\n1. Coffee\n2. Text to lower\nSelect you example: ");
            var example = Console.ReadLine();

            Console.WriteLine();

            if (example == "1")
            {
                Beverage espresso = new Espresso();
                espresso.DisplayCost();

                Beverage darkRoast = new DarkRoast();
                darkRoast = new Mocha(darkRoast);
                darkRoast = new Mocha(darkRoast);
                darkRoast = new Whip(darkRoast);
                darkRoast.DisplayCost();

                Beverage houseBland = new HouseBland();
                houseBland = new Soy(houseBland);
                houseBland = new Mocha(houseBland);
                houseBland = new Whip(houseBland);
                houseBland.DisplayCost();
            }
            else
            {
                Console.Write("Write your path to text file: ");
                var filepath = Console.ReadLine();

                try
                {
                    using (LowerCaseInputStream reader = new LowerCaseInputStream(filepath))
                    {
                        while (true)
                        {
                            var line = reader.ReadLine();
                            if (line == null)
                            {
                                break;
                            }
                            Console.WriteLine(line); // Use line.
                        }
                    }
                }
                catch (FileNotFoundException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
Esempio n. 11
0
        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();
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            IBeverage beverage1 = new DarkRoast();

            beverage1 = new MochaCondiment(beverage1);
            beverage1 = new MochaCondiment(beverage1);
            beverage1 = new WhipCondiment(beverage1);
            Console.WriteLine(beverage1.Description + " $" + beverage1.Cost());

            IBeverage beverage2 = new Espresso();

            beverage2 = new MochaCondiment(beverage2);
            beverage2 = new WhipCondiment(beverage2);
            Console.WriteLine(beverage2.Description + " $" + beverage2.Cost());
        }
Esempio n. 13
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();
        }
Esempio n. 14
0
        static void Main()
        {
            Beverage coffee = new DarkRoast();

            coffee = new Mocha(coffee);
            coffee = new Mocha(coffee);
            coffee = new Soy(coffee);

            Console.WriteLine("{0} {1}", coffee.Description, coffee.Cost);

            coffee = new HouseBlend();
            coffee = new Soy(coffee);

            Console.WriteLine("{0} {1}", coffee.Description, coffee.Cost);

            Console.ReadLine();
        }
Esempio n. 15
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);
        }
Esempio n. 17
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()}");
        }
Esempio n. 18
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());
        }
Esempio n. 19
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();
        }
Esempio n. 20
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());
        }
        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()}");
        }
Esempio n. 22
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();
        }
Esempio n. 23
0
File: Program.cs Progetto: 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();
        }
Esempio n. 24
0
        static void Main(string[] args)
        {
            Console.WriteLine("C# StarbuzzCoffe");

            Beverage beverage = new Expresso();

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

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine(beverage2.GetDescription() + " $" + beverage2.GetCost());

            Beverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine(beverage3.GetDescription() + " $" + beverage3.GetCost());
        }
Esempio n. 25
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();
        }
Esempio n. 26
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());
        }
        public static void Main()
        {
            Beverage beverage = new Expresso();

            Console.WriteLine(beverage.ToString());

            Beverage beverage2 = new DarkRoast();

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

            Beverage beverage3 = new HouseBlend
            {
                Size = BeverageSize.Venti
            };

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine(beverage3.ToString());
        }
Esempio n. 28
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();
        }
Esempio n. 29
0
        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();
        }