Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. function [TotalTax, EffectiveTaxRate] = student_solution(income)
  2.  
  3. %[TotalTax, EffectiveTaxRate] = student_solution(income)
  4. %This function calculates the your total tax and effective tax rates. To
  5. % use this function remeber that your first output is total tax and second
  6. % out put is your effective tax rate.
  7. %
  8. %Input arguments:
  9. % income : the income you wish to find the total tax and effective tax rate
  10. % for
  11. %
  12. %Output arguments:
  13. % TotalTax : the total amount that an amount of income will have to pay
  14. % EffectiveTaxRate : the percent of your income that an income will have
  15. % to pay.
  16.  
  17. ten = .1*9225;
  18. fifteen = .15*(37450-9225);
  19. twentyfive = .25*(90750-37450);
  20. twentyeight = .28*(189300-90750);
  21. thritythree = .33*(411500-189300);
  22. thirtyfive = .35*(413200-411500);
  23. DE = 10300;
  24. taxi = income - DE;
  25.  
  26. if taxi < 9225
  27. TotalTax = .1*(taxi);
  28. EffectiveTaxRate = TotalTax/income;
  29.  
  30. elseif taxi > 9225 && taxi < 37450
  31. TotalTax = ten + .15*(taxi-9225);
  32. EffectiveTaxRate = TotalTax/income;
  33.  
  34. elseif taxi > 37450 && taxi < 90750
  35. TotalTax = ten + fifteen + .25*(taxi - 37450);
  36. EffectiveTaxRate = TotalTax/income;
  37.  
  38. elseif taxi > 90750 && taxi < 189300
  39. TotalTax = ten + fifteen + twentyfive + .28*(taxi - 90750);
  40. EffectiveTaxRate = TotalTax/income;
  41.  
  42. elseif taxi > 189300 && taxi < 411500
  43. TotalTax = ten + fifteen + twentyfive + twentyeight + .33*(taxi - 189300);
  44. EffectiveTaxRate = TotalTax/income;
  45.  
  46. elseif taxi > 411500 && taxi < 413200
  47. TotalTax = ten + fifteen + twentyfive +twentyeight + thritythree + .35*(taxi - 411500);
  48. EffectiveTaxRate = TotalTax/income;
  49.  
  50. elseif taxi > 413200
  51. TotalTax = ten + fifteen + twentyfive + twentyeight + thirtythree + thirtyfive + .396*(taxi-413200);
  52. EffectiveTaxRate = TotalTax/income;
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement