Beispiel #1
0
        /// <summary>
        /// Main entry method for the Starbuzz Coffee console application
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            // Creates an order for an Espresso coffee with no condiments
            Beverage espresso = new Espresso();

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

            // Creates an order for a DarkRoast coffee with 2 mocha and a whip condiment
            Beverage darkRoast = new DarkRoast();

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

            // Creates an order for a houseblend coffee with a soy, mocha and whip condiment
            Beverage houseBlend = new HouseBlend();

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

            Console.ReadLine();
        }
Beispiel #2
0
        private static void Main(string[] args)
        {
            // straight espresso
            Beverage beverage = new Espresso {
                Size = Sizes.TALL
            };

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

            beverage = new DarkRoast {
                Size = Sizes.GRANDE
            };
            beverage = new Mocha(beverage);
            beverage = new Mocha(beverage);
            beverage = new Whip(beverage);
            Console.WriteLine($"{beverage.GetDescription()}: ${beverage.Cost()}");

            beverage = new HouseBlend {
                Size = Sizes.VENTI
            };
            beverage = new Soy(beverage);
            beverage = new Mocha(beverage);
            beverage = new Whip(beverage);
            Console.WriteLine($"{beverage.GetDescription()}: ${beverage.Cost()}");

            Console.ReadLine();
        }
Beispiel #3
0
        static void Main()
        {
            // Expresso without condiments
            Beverage beverage = new Expresso();

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

            // DarkRoast
            Beverage beverage2 = new DarkRoast();

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

            // HouseBlend
            Beverage beverage3 = new HouseBlend();

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

            Console.ReadKey();
        }
Beispiel #4
0
        private static void PrintDarkRoastDoubleMochaWhip()
        {
            Beverage beverage = new DarkRoast();

            beverage = new Mocha(beverage);
            beverage = new Mocha(beverage);
            beverage = new Whip(beverage);
            Console.Out.WriteLine(beverage);
        }
Beispiel #5
0
        private static void PrintHouseBlendSoyMochaWhip()
        {
            Beverage beverage = new HouseBlend();

            beverage = new Soy(beverage);
            beverage = new Mocha(beverage);
            beverage = new Whip(beverage);
            Console.Out.WriteLine(beverage);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            //Refer Coffee Shop class diagram

            #region Somedescription
            Console.WriteLine("Welcome to Starbuzz Coffee");
            Console.WriteLine("");
            Console.WriteLine("");
            Console.WriteLine("We usually do care about customers,");
            Console.WriteLine("But profit is more important to us.");
            Console.WriteLine("So today due to excessive amount of orders,");
            Console.WriteLine("We would not cater to your needs and show you what programmer decides");
            Console.WriteLine("Yes you read it right the programmer not the barista");
            Console.WriteLine("");
            #endregion

            #region PatternImplementation
            Beverage beverage = new Espresso();
            Console.WriteLine(beverage.getDescription() + " "
                              + beverage.cost() + "$");

            /*In the code example below and above we have used Liskov Substitution principle just a fancy name
             * for saying the thing that inherited class can be substituted for the parent class like we use
             * Beverage but create espresso object*/


            Beverage beverage2 = new Espresso();
            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);

            // The above order translates to one espresso with two shots of mocha. Silly order :)


            Console.WriteLine(beverage2.getDescription() + " "
                              + beverage2.cost() + "$");
            #endregion

            #region EndDescription
            Console.WriteLine("");
            Console.WriteLine("Thank you for your time at StarBuzz");
            Console.WriteLine("We added above both orders even if you don't wanna drink");
            Console.WriteLine("Warning: It's not free either");
            Console.WriteLine("Our Programmer is our Barista");
            #endregion

            Console.ReadLine();
        }
Beispiel #7
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());
        }
Beispiel #8
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()));
        }
Beispiel #9
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("------------------------------------------------------------------");
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            AbstractBeverage beverage = new Espresso();

            Console.WriteLine($"{beverage.Description} ${beverage.Cost / 100f :N2}");

            AbstractBeverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine($"{beverage2.Description} ${beverage2.Cost / 100f :N2}");

            AbstractBeverage beverage3 = new HouseBlend();

            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine($"{beverage3.Description} ${beverage3.Cost / 100f :N2}");

            Console.WriteLine("Press any key to continue . . .");
            Console.ReadKey();
        }