Пример #1
0
        public static TaxTable Add(decimal minThreshold,
                                   decimal maxThreshold,
                                   decimal accumulatedTaxFromPreviousBracket,
                                   decimal marginalTaxRate)
        {
            if (!Validator.IsBetween(minThreshold, maxThreshold))
            {
                throw new System.Exception("Min value cannot be greater than or equal to max value");
            }

            var incomeThreshold = CalculateIncomeThreshold(minThreshold);
            var taxBracket      = new TaxBracket(accumulatedTaxFromPreviousBracket, marginalTaxRate, incomeThreshold);
            var taxTableItem    = new TaxTable(minThreshold, maxThreshold, taxBracket);

            return(taxTableItem);
        }
Пример #2
0
 private decimal CalculateMarginalTaxableAmount(decimal annualTaxableIncome, TaxBracket taxBracket)
 {
     return(annualTaxableIncome - taxBracket.IncomeThreshold);
 }
Пример #3
0
 public TaxTable(decimal minThreshold, decimal maxThreshold, TaxBracket incomeTaxBracket)
 {
     MinThreshold     = minThreshold;
     MaxThreshold     = maxThreshold;
     IncomeTaxBracket = incomeTaxBracket;
 }
Пример #4
0
        public decimal CalculateMarginalTax(decimal annualTaxableIncome, TaxBracket taxBracket)
        {
            var marginalTaxableAmount = CalculateMarginalTaxableAmount(annualTaxableIncome, taxBracket);

            return(marginalTaxableAmount * taxBracket.MarginalTaxRate);
        }