Bernie's proposed healthcare plan has been released -- can we make a calculator for this?

Sorry if I'm late to the party, but was bored and saw this recommendation in /r/SandersForPresident and knocked it out in python. Feel free to throw this into a CGI script and use it on a site or whatever

Usage/examples:

Prompt for income:

$ python ./bernie.py
Enter your current income: 490000
Your tax right now: 194040.00
Your tax with Bernie:   181300.00
You would pay 12740.00 less in taxes annually

Income supplied via argument:

$ python ./bernie.py 12000000
Your tax right now: 4752000.00
Your tax with Bernie:   6240000.00
You would pay 1488000.00 more in taxes anually

Code:

#!/usr/bin/python
#Based on https://i.imgur.com/drfyv82.png
def main():
    income = getIncome()
    calcTax(float(income))

def getIncome():
    import sys
    if len(sys.argv) > 1:
        income = int(sys.argv[1])
    else:
        income = raw_input("Enter your current income: ")

    return income

def calcTax(income):
    if income < 18451:
        currentTax = income*.10
        futureTax = income*.10
    elif income < 74901 :
        currentTax = income*.15
        futureTax = income*.15
    elif income < 151201 :
        currentTax = income*.25
        futureTax = income*.25
    elif income < 230451 :
        currentTax = income*.28
        futureTax = income*.28
    elif income < 250001 :
        currentTax = income*.33
        futureTax = income*.33
    elif income < 411501 :
        currentTax = income*.33
        futureTax = income*.37
    elif income < 464851 :
        currentTax = income*.35
        futureTax = income*.37
    elif income < 500000 :
        currentTax = income*.396
        futureTax = income*.37
    elif income < 2000000 :
        currentTax = income*.396
        futureTax = income*.43
    elif income < 10000000 :
        currentTax = income*.396
        futureTax = income*.48
    else:
        currentTax = income*.396
        futureTax = income*.52

    print "Your tax right now:\t%.2f"% currentTax
    print "Your tax with Bernie:\t%.2f"%futureTax
    diff = currentTax-futureTax
    if diff < 0:
        print "You would pay %.2f more in taxes anually"%abs(diff)
    elif diff > 0:
        print "You would pay %.2f less in taxes annually"%abs(diff)
    else:
        print "You would pay the same amount of tax."

main()
/r/CodersForSanders Thread