public Coffee PrepareCoffee(CoffeeSelection selection) { var coffee = coffeeMachine.BrewFilterCoffee(); Console.WriteLine($"Coffee is ready! \n {coffee.CoffeeBeansUsed.Description}"); return(coffee); }
static int Main(string[] args) { Dictionary <CoffeeSelection, CoffeeBean> beans = new Dictionary <CoffeeSelection, CoffeeBean>(); beans.Add(CoffeeSelection.Cappuccino, new CoffeeBean("Arabica", MAX_BEANS)); beans.Add(CoffeeSelection.Espresso, new CoffeeBean("Robusta", MAX_BEANS)); beans.Add(CoffeeSelection.FilterCoffee, new CoffeeBean("Liberica", MAX_BEANS)); CoffeeMachine coffeeMachine = new CoffeeMachine(beans); do { try { do { Console.WriteLine("-------------------------------------------------------------------------------"); Console.WriteLine("CoffeeMachine wait order"); Console.WriteLine(""); Console.WriteLine("To choose kind coffee:"); Console.WriteLine("1. Cappuccino\n2. Espresso\n3. FilterCoffee"); Console.WriteLine(""); CoffeeSelection coffeType = (CoffeeSelection)getNumber(Enum.GetNames(typeof(CoffeeSelection)).Length); int quantity = getQuantity(); Coffee coffee = coffeeMachine.BrewCoffee(coffeType, quantity); Console.WriteLine("Coffee {0} , {1} milliliters. ", coffee.CoffeeSelection, coffee.Quantity); Console.WriteLine("Grains residue: Arabica {0}, Robusta {1}, Liberica {2} ", beans[CoffeeSelection.Cappuccino].Quantity, beans[CoffeeSelection.Espresso].Quantity, beans[CoffeeSelection.FilterCoffee].Quantity); Console.WriteLine(); Console.WriteLine("In order to exit press key ESC and ENTER"); Console.WriteLine(""); Console.WriteLine("You want add coffeebean into CoffeeMachine ? y - yes anyKey - no"); //add of coffeeBeans to CoffeeMachine if (Console.ReadKey().Key == ConsoleKey.Y) { addBeans(beans); } else if (Console.ReadKey().Key == ConsoleKey.Escape) { return(0); } }while (Console.ReadKey().Key != ConsoleKey.Escape); } catch (CoffeeExeption ex) { Console.WriteLine("-------------------------------------------------------------------------------"); Console.WriteLine(ex.Message); Console.WriteLine(); } finally { Console.WriteLine("In order to exit press key ESC or ENTER to continue"); } }while (Console.ReadKey().Key != ConsoleKey.Escape); return(0); }
public Coffee(int quantity, CoffeeSelection coffeeSelection) { Quantity = quantity; CoffeeSelection = coffeeSelection; }
public Coffee BrewCoffee(CoffeeSelection coffeeSelection, int guantity) { //get for key CoffeeBean -> get GroundCoffee -> get Coffee return(_brewingUnit.Brew(coffeeSelection, _grinderUnit.Grind(_beans[coffeeSelection], guantity))); }
public Coffee Brew(CoffeeSelection coffeeSelecton, GroundCoffee groundCoffee) { return(new Coffee(groundCoffee.Quantity, coffeeSelecton)); }