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) }); }
public override Product Calculate(double consumption) { TariffValidator.Validate(consumption); return(new Product { Consumption = consumption, TariffType = TariffType.BasicTariff, AnnualCost = (BaseCostPerMonth * 12) + (ConsumptionCost * (decimal)consumption) }); }