#!/usr/bin/env python3; ############################################################################### # This program computes federal income tax for single taxpayers. # # Copyright © 2020 Richard Lesh. All rights reserved. ############################################################################### import Utils import sys # Begin Main income = 0. income_tax = 0. if (len(sys.argv) == 2) : income = Utils.stodWithDefault(sys.argv[1], 0) else : print("Syntax: {0:s} income".format(sys.argv[0])) sys.exit(1) if (income <= 9875.) : income_tax += income * 0.10 else : income_tax += 9875. * 0.10 if (income <= 40125.) : income_tax += (income - 9875.) * 0.12 else : income_tax += (40125. - 9875.) * 0.12 if (income <= 85525.) : income_tax += (income - 40125.) * 0.22 else : income_tax += (85525. - 40125.) * 0.22 if (income <= 163300.) : income_tax += (income - 85525.) * 0.24 else : income_tax += (163300. - 85525.) * 0.24 if (income <= 207350.) : income_tax += (income - 163300.) * 0.32 else : income_tax += (207350. - 163300.) * 0.32 if (income <= 518400.) : income_tax += (income - 207350.) * 0.35 else : income_tax += (518400. - 207350.) * 0.35 if (income > 518400.) : income_tax += (income - 518400.) * 0.37 print("Federal Income Tax: ${0:.2f}".format(income_tax))