Skip to content

Instantly share code, notes, and snippets.

@Juice10
Last active February 15, 2019 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Juice10/16e934d6bfa6496759bfc0af0a98e124 to your computer and use it in GitHub Desktop.
Save Juice10/16e934d6bfa6496759bfc0af0a98e124 to your computer and use it in GitHub Desktop.
Calculate what percentage of taxes you'd pay if AOC's 70% tax bracket gets added
BRACKETS = {
0 => 0.1,
9700 => 0.12,
39475 => 0.22,
84_200 => 0.24,
160_725 => 0.32,
204_100 => 0.35,
510_300 => 0.37,
10_000_000 => 0.70,
}
def taxes(income)
tax = 0
BRACKETS.to_a.reverse.each do |bracket, tax_percentage|
if (income >= bracket)
# puts "income: #{income} bracket #{bracket} tax% #{tax_percentage}"
in_bracket_amount = income - bracket
tax += in_bracket_amount * tax_percentage
# puts "taxation on #{in_bracket_amount}: #{in_bracket_amount * tax_percentage}"
income = bracket
end
end
tax
end
income = 700_000_000 # enter your yearly income here
puts "Income: #{income}"
puts "Taxes to pay: #{taxes(income).round(2)}"
puts "Percentage of income spent on taxes: #{taxes(income) / income * 100}%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment