Every year the US Internal Revenue Service (IRS) uses the Consumer Price Index t
ID: 2086813 • Letter: E
Question
Every year the US Internal Revenue Service (IRS) uses the Consumer Price Index to adjust the boundaries between taxation rates to prevent "bracket creep", a phenomenon in which tax rates would increase due to inflation without an increase in "real" income. For the year 2017, the "Tax Rate" and the "Taxable Income Bracket" are as shown in the table below Tax Rate 10% 15% 25% 28% 33% 35% 39.6% Taxable Income Bracket 0 to 9,325 to 37,950 to 1,900 to 91,650 to 16,700 to 18,400 to 9,325 37,950 91,900 191,650 416,700 418,400 unlimitted Craft a User-Defined Function (UDF) that: accepts a value forTaxable Income as the first variable in the input argument list. returns the tax rate associated with that amount of Taxable Income, expressed as a decimal number (e.g., 27% is 0.27) " If a negative value of Taxable Income is specified an easily understood error message should be displayed to the CW a Tax Rate of zero should be returned in the output argument. Note 1: Note 2: No data should be "echoed" to the CW You should notice that the value at the boundary between brackets appears in both the lower and higher Tax Rate Bracket. This is because the amount of tax owed for that amount is the same for either bracket. For this assignment, return the lower Tax Rate to identify the bracketExplanation / Answer
function [ fin_rate ] = taxRate( income ) %taxRate - Returns the tax rate for given income % If Income is a negative number return 0 and display error if income < 0 fin_rate = 0; disp('Taxable Income entered is invalid. Please enter a positive value.'); return; end % If Income is zero, then return 0 if income == 0 fin_rate = 0; return; end % Store the boundaries and rates of tax brackets boundaries = [0 9325 37950 91900 191650 416700 418400 Inf]; rates = [0.1 0.15 0.25 0.28 0.33 0.35 0.396]; % Assign a variable to keep track of Amount Left from Income amount = income; % Initialize it with the income % Create a variable to store the tax paid tax_paid = 0; % Index for current bracket cur_bracket = 1; % While amount being processed is more than the current bracket, % tax still needs to be processed while boundaries(cur_bracket) < amount % Update the amount of tax to be paid for the current bracket tax_paid = tax_paid + rates(cur_bracket) * (min(boundaries(cur_bracket + 1), income) - boundaries(cur_bracket)); % Update the tax bracket cur_bracket = cur_bracket + 1; end % Get the rate, from the total income and the tax paid fin_rate = tax_paid / income; end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.