public TaxTableGenerator() { TaxTableData = new List <TaxTable>() { TaxTable.Add(0, 18200, 0, 0m), TaxTable.Add(18201, 37000, 0, 0.19m), TaxTable.Add(37001, 87000, 3572, 0.325m), TaxTable.Add(87001, 180000, 17547, 0.37m), TaxTable.Add(180001, decimal.MaxValue, 54547, 0.45m), }; }
public TaxTableGenerator() { TaxTableData = new List <TaxTable>() { //Used the tax rates 2012-2013 from Coding Exercise.pdf, to match the output //If this has to be on basis of tax rates 2017-2018, change here. TaxTable.Add(0, 18200, 0, 0m), TaxTable.Add(18201, 37000, 0, 0.19m), TaxTable.Add(37001, 80000, 3572, 0.325m), TaxTable.Add(80001, 180000, 17547, 0.37m), TaxTable.Add(180001, decimal.MaxValue, 54547, 0.45m), }; }
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); }