protected override Coffee CreateCoffee(CoffeType type) { Coffee coffee = null; switch (type) { case CoffeType.Americano: coffee = new AmericanStyleAmericano(); break; case CoffeType.Espresso: coffee = new AmericanStyleEspresso(); break; case CoffeType.Cappuccino: coffee = new AmericanStyleCappuccino(); break; case CoffeType.CaffeLatte: coffee = new AmericanStyleCaffeLatte(); break; } return(coffee); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] CoffeType coffeType) { if (id != coffeType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(coffeType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CoffeTypeExists(coffeType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(coffeType)); }
public void PrepareCofee(CoffeType coffeType) { if (_waterLevel <= 10) { Console.WriteLine("Water level is LOW please fill the tank"); FillTank(); } if (_coffeLevel <= 10) { Console.WriteLine("Coffee level is LOW please fill the tank"); AddCoffeBeans(); } switch (coffeType) { case CoffeType.Americano: HeatWater(95); _waterLevel -= 5; _waterTemperature -= 5; break; case CoffeType.Espresso: HeatWater(90); _waterLevel -= 10; _waterTemperature -= 5; break; } _coffeLevel -= 10; Console.WriteLine("Your {0} is ready! Bon apetit", coffeType); }
public async Task <IActionResult> Create([Bind("Id,Name")] CoffeType coffeType) { if (ModelState.IsValid) { _context.Add(coffeType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(coffeType)); }
public void BuyCoffee(string size, string type) { CoffePrice coffePrice = (CoffePrice)Enum.Parse(typeof(CoffePrice), size); CoffeType coffeType = (CoffeType)Enum.Parse(typeof(CoffeType), type); if (this.coins >= (int)coffePrice) { this.coffeSold.Add(coffeType); this.coins = 0; } }
public Coffee OrderCofee(CoffeType type) { Coffee coffee = CreateCoffee(type); coffee.GrindCoffee(); coffee.MakeCoffee(); coffee.PourIntoCup(); Console.WriteLine("Your coffee, you are welcome!"); return(coffee); }
public Coffee GetCoffee(CoffeType coffeeType) { switch (coffeeType) { case CoffeType.Regular: return new Coffee(0, 150); case CoffeType.Double: return new Coffee(0, 200); case CoffeType.Cappuccino: return new Coffee(100, 100); case CoffeType.Macchiato: return new Coffee(200, 100); default: throw new ArgumentException(); } }
public double GetTotalPrice(double amount, CoffeType coffeType) { double totalPrice = 0; if (coffeType == CoffeType.Sahlep) { totalPrice += amount * 2.6; } else if (coffeType == CoffeType.Tea) { totalPrice += amount * 1.25; } else if (coffeType == CoffeType.Water) { totalPrice += amount * 0.5; } return(totalPrice); }
public static Coffe GetCoffe(CoffeType coffeType) { switch (coffeType) { case CoffeType.Regular: return(new Coffe(0, 150)); case CoffeType.Double: return(new Coffe(0, 200)); case CoffeType.Macchiato: return(new Coffe(200, 100)); case CoffeType.Cappuccino: return(new Coffe(100, 100)); default: throw new ArgumentException(); } }
public override void Make() { CoffeType.Set("small"); }
public override void Make() { CoffeType.Set("large"); }
protected abstract Coffee CreateCoffee(CoffeType type);
public override void Make() { CoffeType.Set("middle"); }