Exemplo n.º 1
0
        public TariffModel RunTariff(int consumption, BuilderModel data)
        {
            var tariffModel = new TariffModel();
            var basicCost   = data.BaseCost * data.frequency.GetValueOrDefault();      // To calculate the basic cost yearly.

            tariffModel.AnnualCost = basicCost + (consumption * data.ConsumptionCost); // Calculation logic for Basic engine.
            tariffModel.TariffName = "Basic electricity tariff";

            return(tariffModel);
        }
        public TariffModel RunTariff(int consumption, BuilderModel data)
        {
            var tariffModel = new TariffModel();

            tariffModel.TariffName = "Packaged electricity tariff";

            if (consumption <= 4000)
            {
                tariffModel.AnnualCost = 800; // Return 800 if the consumption is less than or equal to 4000
            }
            else
            {
                var differenceFromBaseCost = consumption - 4000;
                tariffModel.AnnualCost = data.BaseCost + (differenceFromBaseCost * data.ConsumptionCost); // Calculation logic for Packaged engine.
            }

            return(tariffModel);
        }