Guest User

Untitled

a guest
May 25th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. function lmito(income, initial_value = 200, increased_value = 530,
  2. taper_one_start = 37000, taper_two_start = 90000, taper_in_rate = 0.03,
  3. taper_out_rate = 0.015) {
  4. if (income < taper_one_start) {
  5. return initial_value * -1;
  6. }
  7. else if (income >= taper_one_start & income <= taper_two_start) {
  8. let tapered_in_lmito = (initial_value + (income - taper_one_start) * taper_in_rate);
  9. if (tapered_in_lmito < increased_value) {
  10. return tapered_in_lmito * -1;
  11. }
  12. else {
  13. return increased_value * -1;
  14. }
  15. }
  16. else if (income >= taper_two_start) {
  17. let tapered_out_lmito = (increased_value - (income - taper_two_start) *
  18. taper_out_rate) * -1;
  19. if (tapered_out_lmito < 0) {
  20. return tapered_out_lmito;
  21. }
  22. else {
  23. return 0;
  24. }
  25. }
  26. else {
  27. return 0;
  28. }
  29. }
  30.  
  31. function lmito_lab(income, initial_value = 350, increased_value = 927.5,
  32. taper_one_start = 37000, taper_two_start = 90000, taper_in_rate = 0.0525,
  33. taper_out_rate = 0.02625) {
  34. if (income < taper_one_start) {
  35. return initial_value * -1;
  36. }
  37. else if (income >= taper_one_start & income <= taper_two_start) {
  38. let tapered_in_lmito = (initial_value + (income - taper_one_start) * taper_in_rate);
  39. if (tapered_in_lmito < increased_value) {
  40. return tapered_in_lmito * -1;
  41. }
  42. else {
  43. return increased_value * -1;
  44. }
  45. }
  46. else if (income >= taper_two_start) {
  47. let tapered_out_lmito = (increased_value - (income - taper_two_start) * taper_out_rate) * -1;
  48. if (tapered_out_lmito < 0) {
  49. return tapered_out_lmito;
  50. }
  51. else {
  52. return 0;
  53. }
  54. }
  55. else {
  56. return 0;
  57. }
  58. }
  59.  
  60.  
  61. function lito(income, value = 445, taper_start = 37000, taper_rate = 0.015) {
  62. if (income < taper_start) {
  63. return value * -1;
  64. } else {
  65. let tapered_lito = (value - (income - taper_start) * taper_rate) * -1;
  66. if (tapered_lito < 0) {
  67. return tapered_lito;
  68. } else {
  69. return 0;
  70. }
  71. }
  72. }
  73.  
  74. function value_of_bracket_cut(income) {
  75. if (income < 87000) {
  76. return 0;
  77. } else if (income > 90000) {
  78. return 135;
  79. } else {
  80. let base_tax = (income - 87000) * 0.37;
  81. let change_tax = (income - 87000) * 0.325;
  82. return base_tax - change_tax;
  83. }
  84. }
  85.  
  86. function income_tax(income) {
  87. if (income <= 18200) {
  88. return 0;
  89. }
  90. let income_tax_owed = (income - 18200) * 0.19;
  91. return income_tax_owed;
  92. }
  93.  
  94. function governments_plan(income) {
  95. let initial_value = 200;
  96. let income_tax_owed = income_tax(income) + lito(income);
  97. if (income_tax_owed < initial_value) {
  98. if (income_tax_owed >= 0) {
  99. return Math.round(income_tax_owed);
  100. } else {
  101. return 0;
  102. }
  103. } else {
  104. let total_benefit = lmito(income) * -1 + value_of_bracket_cut(income);
  105. return Math.round(total_benefit);
  106. }
  107. }
  108.  
  109. function labors_plan(income) {
  110. let initial_value = 350;
  111. let income_tax_owed = income_tax(income) + lito(income);
  112. if (income_tax_owed < initial_value) {
  113. if (income_tax_owed >= 0) {
  114. return Math.round(income_tax_owed);
  115. } else {
  116. return 0;
  117. }
  118. } else {
  119. lmito_benefit = lmito_lab(income);
  120. let total_benefit = lmito_benefit * -1 + value_of_bracket_cut(income);
  121. return Math.round(total_benefit);
  122. }
  123. }
  124.  
  125.  
  126. function difference_between(income) {
  127. let output = {
  128. 'income': income,
  129. 'liberal': governments_plan(income),
  130. 'labor': labors_plan(income),
  131. 'difference': labors_plan(income) - governments_plan(income)
  132. };
  133. return output;
  134. }
Add Comment
Please, Sign In to add comment