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);
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
 private static void Display(IBeverage beverage)
 {
     Console.WriteLine(beverage.GetDescription() + " $" + beverage.Cost());
 }
Пример #5
0
 public double Cost()
 {
     return(_beverage.Cost() + _beverage.Cost() * _percent);
 }
Пример #6
0
 public double Cost()
 {
     return(_beverage.Cost() + .20);
 }
Пример #7
0
 public double Cost()
 {
     return(beverage.Cost());
 }
 public float Cost()
 {
     return(0.15f + beverage.Cost());
 }
Пример #9
0
/*      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());
        }
Пример #10
0
 public override int Cost()
 {
     return(bev.Cost() + 8);
 }
Пример #11
0
 public double Cost()
 {
     return(_beverage.Cost() + _price);
 }
Пример #12
0
 public int Cost()
 {
     return(_cost + _beverage.Cost() + ComputeExtraCostForSize());
 }
Пример #13
0
 public float Cost()
 {
     return(_beverage.Cost() + 2.00f);
 }
Пример #14
0
 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);
 }
Пример #16
0
 public float Cost()
 {
     return(beverage.Cost() + .20f);
 }
Пример #17
0
 public float Cost()
 {
     return(_beverage.Cost() + 1.25f);
 }
Пример #18
0
 public double Cost()
 {
     return(price + beverage.Cost());
 }