Exemplo n.º 1
0
        public override double Cost()
        {
            Size   size = _beverage.GetSize();
            double cost;

            switch (size)
            {
            case Size.TALL:
                cost = 0.10;
                break;

            case Size.GRANDE:
                cost = 0.15;
                break;

            case Size.VENTI:
                cost = 0.20;
                break;

            default:
                cost = 0;
                break;
            }

            return(cost + _beverage.Cost());
        }
Exemplo n.º 2
0
        public override double GetCost()
        {
            var size = _beverage.GetSize();

            switch (size)
            {
            case CupSize.Small:
                return(_beverage.GetCost() + 0.10);

            case CupSize.Middle:
                return(_beverage.GetCost() + 0.15);

            case CupSize.Big:
                return(_beverage.GetCost() + 0.20);
            }
            throw new ArgumentException(nameof(CupSize));
        }
Exemplo n.º 3
0
 public override Size GetSize()
 {
     return(beverage.GetSize());
 }
Exemplo n.º 4
0
 public BeverageDecorator(Beverage beverage) : base(beverage.GetSize())
 {
     this.beverage = beverage;
 }
Exemplo n.º 5
0
 public Mocha(Beverage beverage)
 {
     _beverage = beverage;
     Size = _beverage.GetSize();
 }