예제 #1
0
        public override Product Calculate(double consumption)
        {
            TariffValidator.Validate(consumption);

            return(new Product
            {
                Consumption = consumption,
                TariffType = TariffType.PackagedTariff,
                AnnualCost = consumption <= UpperBoundConsumption ? BaseCost : BaseCost + ((decimal)(consumption - UpperBoundConsumption) * ConsumptionCost)
            });
        }
예제 #2
0
        public override Product Calculate(double consumption)
        {
            TariffValidator.Validate(consumption);

            return(new Product
            {
                Consumption = consumption,
                TariffType = TariffType.BasicTariff,
                AnnualCost = (BaseCostPerMonth * 12) + (ConsumptionCost * (decimal)consumption)
            });
        }