void Update() { if (Input.GetKeyDown(KeyCode.Return)) { Debug.Log($"Description: {_beverage.GetDescription()}"); Debug.Log($"Cost: {_beverage.Cost()}"); } if (Input.GetKeyDown(KeyCode.D)) { _beverage = new DarkRoast(); _beverage = new Whip(_beverage); _beverage = new Milk(_beverage); } else if (Input.GetKeyDown(KeyCode.H)) { _beverage = new HouseBlend(); _beverage = new Whip(_beverage); } else if (Input.GetKeyDown(KeyCode.E)) { _beverage = new Espresso(); _beverage = new Whip(_beverage); } }
public double Cost() { double cost = beverage.Cost(); switch (this.Size) { case BeverageSize.TALL: cost += 0.30; break; case BeverageSize.GRANDE: cost += 0.35; break; case BeverageSize.VENTI: cost += 0.40; break; } return(cost); }
public double Cost() { double soyCost; if (Size == BeverageSize.Tall) { soyCost = .10d; } else if (Size == BeverageSize.Grande) { soyCost = .15d; } else if (Size == BeverageSize.Venti) { soyCost = .20d; } else { throw new NotSupportedException(nameof(Soy) + " does not support calculating cost for BeverageSize " + Size.ToString()); } return(_beverage.Cost() + soyCost); }
private static void Display(IBeverage beverage) { Console.WriteLine(beverage.GetDescription() + " $" + beverage.Cost()); }
public double Cost() { return(_beverage.Cost() + _beverage.Cost() * _percent); }
public double Cost() { return(_beverage.Cost() + .20); }
public double Cost() { return(beverage.Cost()); }
public float Cost() { return(0.15f + beverage.Cost()); }
/* De esta forma es que se modifica el precio de la bebida * conforme se le van agregando condimentos, cada condimento * define su propio precio y descripcion que se agregan al * precio original de la bebida, * * pero ¿cómo es esto posible si la interfaz que implementan * los condimentos es diferente? * * entra a la interfaz ICondimentDecorator para analizarla */ public double Cost() { return(0.20 + beverage.Cost()); }
public override int Cost() { return(bev.Cost() + 8); }
public double Cost() { return(_beverage.Cost() + _price); }
public int Cost() { return(_cost + _beverage.Cost() + ComputeExtraCostForSize()); }
public float Cost() { return(_beverage.Cost() + 2.00f); }
public virtual double Cost() { return(Beverage.Cost()); }
public static void Print(this IBeverage beverage) { Console.WriteLine("{2} {0} {1:c}", beverage.GetDescription, beverage.Cost(), beverage.Size); }
public float Cost() { return(beverage.Cost() + .20f); }
public float Cost() { return(_beverage.Cost() + 1.25f); }
public double Cost() { return(price + beverage.Cost()); }