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(); }
/// <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(); }
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(); }
private static void PrintDarkRoastDoubleMochaWhip() { Beverage beverage = new DarkRoast(); beverage = new Mocha(beverage); beverage = new Mocha(beverage); beverage = new Whip(beverage); Console.Out.WriteLine(beverage); }
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()); }
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())); }
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("------------------------------------------------------------------"); }
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(); }