static void Main(string[] args) { //Console.WriteLine("Hello World!"); Coffee blackCoffee = new BlackCoffee(); Console.WriteLine("Prisen for Sort Kaffe er " + blackCoffee.Price()); Coffee latte = new Latte(); Coffee cortado = new Cortado(); Console.WriteLine("Prisen for Latte er " + latte.Price()); Console.WriteLine("Prisen for Cortado er " + cortado.Price()); Console.WriteLine(blackCoffee); Console.WriteLine(latte); Console.WriteLine(cortado); List <Coffee> listOfCoffee = new List <Coffee>(); listOfCoffee.Add(blackCoffee); listOfCoffee.Add(latte); listOfCoffee.Add(cortado); Console.WriteLine(); foreach (var hej in listOfCoffee) { Console.WriteLine(hej.Price()); Console.WriteLine(hej.ToString()); } }
static void Main(string[] args) { //Console.WriteLine("Hello World!"); BlackCoffee blackCoffee = new BlackCoffee(); Cortado cortado = new Cortado(); Latte latte = new Latte(); List <Coffee> CoffeeList = new List <Coffee>(); CoffeeList.Add(blackCoffee); CoffeeList.Add(cortado); CoffeeList.Add(latte); foreach (var kaffe in CoffeeList) { System.Console.WriteLine(kaffe.ToString()); } // System.Console.WriteLine(blackCoffee); // System.Console.WriteLine(cortado); // System.Console.WriteLine(latte); }
static void Main() { { var latte = new Latte(); var cinnamon = new Cinnamon(latte); var lemon = new Lemon(cinnamon, 2); var iceCubes = new IceCubes(lemon, 2, IceCubeType.Dry); var beverage = new ChocolateCrumbs(iceCubes, 2); Console.WriteLine(beverage.GetDescription() + " costs " + beverage.GetCost()); } { var beverage = new ChocolateCrumbs( new IceCubes( new Lemon( new Cinnamon( new Latte()), 2), 2, IceCubeType.Dry), 2); Console.WriteLine(beverage.GetDescription() + " costs " + beverage.GetCost()); } { var latte = new Latte(LatteSize.Double); var cinnamon = new Cinnamon(latte); var lemon = new Lemon(cinnamon, 2); var iceCubes = new IceCubes(lemon, 2, IceCubeType.Dry); var beverage = new ChocolateCrumbs(iceCubes, 2); Console.WriteLine(beverage.GetDescription() + " costs " + beverage.GetCost()); } { var cappuccino = new Cappuccino(CappuccinoSize.Standart); var cinnamon = new Cinnamon(cappuccino); var lemon = new Lemon(cinnamon, 2); var iceCubes = new IceCubes(lemon, 2, IceCubeType.Dry); var liquor = new Liquor(iceCubes, LiquorType.Nut); var beverage = new ChocolateCrumbs(liquor, 2); Console.WriteLine(beverage.GetDescription() + " costs " + beverage.GetCost()); } { var tea = new Tea(TeaType.Green); var cinnamon = new Cinnamon(tea); var lemon = new Lemon(cinnamon, 2); var iceCubes = new IceCubes(lemon, 2, IceCubeType.Dry); var beverage = new ChocolateCrumbs(iceCubes, 2); Console.WriteLine(beverage.GetDescription() + " costs " + beverage.GetCost()); } }
static void Main(string[] args) { BlackCoffee black = new BlackCoffee(); Cortado corta = new Cortado(); Latte latte = new Latte(); Console.WriteLine($"The price is {black.Price()}kr and the strength is {black}."); Console.WriteLine($"The price is {corta.Price()}kr and the strength is {corta} with {corta.mlMilk()} ml milk."); Console.WriteLine($"The price is {latte.Price()}kr and the strength is {latte} with {latte.mlMilk()} ml milk."); }
static void Main(string[] args) { BlackCoffee black = new BlackCoffee(); Cortado cort = new Cortado(); Latte latte = new Latte(); Console.WriteLine($"The price of the coffe: {black.Price()} kr. {black}"); Console.WriteLine($"The price of the coffe: {cort.Price()} kr. {cort} It has {cort.mlMilk()}ml of milk"); Console.WriteLine($"The price of the coffe: {latte.Price()} kr. {latte} It has {latte.mlMilk()}ml of milk"); }
static void Main(string[] args) { BlackCoffee blackCoffee = new BlackCoffee(); Cortado cortado = new Cortado(); Latte latte = new Latte(); List <Coffee> coffeeList = new List <Coffee>(); System.Console.WriteLine(blackCoffee); Console.WriteLine(cortado); Console.WriteLine(latte); foreach (var kaffe in coffeeList) { System.Console.WriteLine(kaffe.ToString()); } }
static void Main(string [] args) { { // Наливаем чашечку латте var latte = new Latte(); // добавляем корицы var cinnamon = new Cinnamon(latte); // добавляем пару долек лимона var lemon = new Lemon(cinnamon, 2); // добавляем пару кубиков льда var iceCubes = new IceCubes(lemon, 2, IceCubeType.Dry); // добавляем 2 грамма шоколадной крошки var beverage = new ChocolateCrumbs(iceCubes, 2); // Выписываем счет покупателю Console.WriteLine($"{beverage.GetDescription()} cost {beverage.GetCost()}"); } { var beverage = new ChocolateCrumbs( // Внешний слой: шоколадная крошка new IceCubes( // | под нею - кубики льда new Lemon( // | | еще ниже лимон new Cinnamon( // | | | слоем ниже - корица new Latte()), // | | | в самом сердце - Латте 2), // | | 2 дольки лимона 2, IceCubeType.Dry), // | 2 кубика сухого льда 2); // 2 грамма шоколадной крошки // Выписываем счет покупателю Console.WriteLine($"{beverage.GetDescription()} cost {beverage.GetCost()}"); } { var latte = new Latte(CofeePortionSize.Double); // добавляем корицы var cinnamon = new Cinnamon(latte); // добавляем пару долек лимона var lemon = new Lemon(cinnamon, 2); // добавляем пару кубиков льда var iceCubes = new IceCubes(lemon, 2, IceCubeType.Dry); // добавляем 2 грамма шоколадной крошки var beverage = new ChocolateCrumbs(iceCubes, 2); // Выписываем счет покупателю Console.WriteLine($"{beverage.GetDescription()} cost {beverage.GetCost()}"); } { var capucino = new Capucino(CofeePortionSize.Double); // добавляем корицы var cinnamon = new Cinnamon(capucino); // добавляем пару долек лимона var lemon = new Lemon(cinnamon, 2); // добавляем пару кубиков льда var iceCubes = new IceCubes(lemon, 2, IceCubeType.Dry); // добавляем 2 грамма шоколадной крошки var chocolateCrumbs = new ChocolateCrumbs(iceCubes, 2); var cream = new Cream(chocolateCrumbs); var chocolatSlice = new ChocolateSlice(cream, 3); var beverage = new Liqour(chocolatSlice, LiquorType.Walnut); // Выписываем счет покупателю Console.WriteLine($"{beverage.GetDescription()} cost {beverage.GetCost()}"); } { var tea = new Tea(TeaSort.Red); // добавляем корицы var cinnamon = new Cinnamon(tea); // добавляем пару долек лимона var lemon = new Lemon(cinnamon, 2); // добавляем пару кубиков льда var iceCubes = new IceCubes(lemon, 2, IceCubeType.Dry); // добавляем 2 грамма шоколадной крошки var beverage = new ChocolateCrumbs(iceCubes, 2); // Выписываем счет покупателю Console.WriteLine($"{beverage.GetDescription()} cost {beverage.GetCost()}"); } }