Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [TotalTax, EffectiveTaxRate] = student_solution(income)
- %[TotalTax, EffectiveTaxRate] = student_solution(income)
- %This function calculates the your total tax and effective tax rates. To
- % use this function remeber that your first output is total tax and second
- % out put is your effective tax rate.
- %
- %Input arguments:
- % income : the income you wish to find the total tax and effective tax rate
- % for
- %
- %Output arguments:
- % TotalTax : the total amount that an amount of income will have to pay
- % EffectiveTaxRate : the percent of your income that an income will have
- % to pay.
- ten = .1*9225;
- fifteen = .15*(37450-9225);
- twentyfive = .25*(90750-37450);
- twentyeight = .28*(189300-90750);
- thritythree = .33*(411500-189300);
- thirtyfive = .35*(413200-411500);
- DE = 10300;
- taxi = income - DE;
- if taxi < 9225
- TotalTax = .1*(taxi);
- EffectiveTaxRate = TotalTax/income;
- elseif taxi > 9225 && taxi < 37450
- TotalTax = ten + .15*(taxi-9225);
- EffectiveTaxRate = TotalTax/income;
- elseif taxi > 37450 && taxi < 90750
- TotalTax = ten + fifteen + .25*(taxi - 37450);
- EffectiveTaxRate = TotalTax/income;
- elseif taxi > 90750 && taxi < 189300
- TotalTax = ten + fifteen + twentyfive + .28*(taxi - 90750);
- EffectiveTaxRate = TotalTax/income;
- elseif taxi > 189300 && taxi < 411500
- TotalTax = ten + fifteen + twentyfive + twentyeight + .33*(taxi - 189300);
- EffectiveTaxRate = TotalTax/income;
- elseif taxi > 411500 && taxi < 413200
- TotalTax = ten + fifteen + twentyfive +twentyeight + thritythree + .35*(taxi - 411500);
- EffectiveTaxRate = TotalTax/income;
- elseif taxi > 413200
- TotalTax = ten + fifteen + twentyfive + twentyeight + thirtythree + thirtyfive + .396*(taxi-413200);
- EffectiveTaxRate = TotalTax/income;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement