Project: Income Tax
US Income Tax is calculated based on brackets. Write a program that uses the tables below to calculate the 2020 income tax. The program should accept two command line arguments. The first is the taxable income amount. The second is the tax table to use either S, M or H for single, married or head-of-household respectively. Use IF/ELSE statements to do the tax computation.
Rate | Taxable Income Bracket | Tax Owed |
---|---|---|
10% |
$0 to $9,875 | 10% of Taxable Income |
12% |
$9,876 to $40,125 | Maximum tax from previous bracket plus 12% of the excess over $9,875 |
22% |
$40,126 to $85,525 | Maximum tax from previous bracket plus 22% of the excess over $40,125 |
24% |
$85,526 to $163,300 | Maximum tax from previous bracket plus 24% of the excess over $85,525 |
32% |
$163,301 to $207,350 | Maximum tax from previous bracket plus 32% of the excess over $163,300 |
35% |
$207,351 to $518,400 | Maximum tax from previous bracket plus 35% of the excess over $207,350 |
37% |
$518,401+ | Maximum tax from previous bracket plus 37% of the excess over $518,400 |
Rate | Taxable Income Bracket | Tax Owed |
---|---|---|
10% |
$0 to $19,750 | 10% of Taxable Income |
12% |
$19,751 to $80,250 | Maximum tax from previous bracket plus 12% of the excess over $19,750 |
22% |
$80,251 to $171,050 | Maximum tax from previous bracket plus 22% of the excess over $80,250 |
24% |
$171,051 to $326,600 | Maximum tax from previous bracket plus 24% of the excess over $171,050 |
32% |
$326,601 to $414,700 | Maximum tax from previous bracket plus 32% of the excess over $326,600 |
35% |
$414,701 to $622,050 | Maximum tax from previous bracket plus 35% of the excess over $414,700 |
37% |
$622,051+ | Maximum tax from previous bracket plus 37% of the excess over $622,050 |
Rate | Taxable Income Bracket | Tax Owed |
---|---|---|
10% |
$0 to $14,100 | 10% of Taxable Income |
12% |
$14,101 to $53,700 | Maximum tax from previous bracket plus 12% of the excess over $14,100 |
22% |
$53,701 to $85,500 | Maximum tax from previous bracket plus 22% of the excess over $53,700 |
24% |
$85,501 to $163,300 | Maximum tax from previous bracket plus 24% of the excess over $85,500 |
32% |
$163,301 to $207,350 | Maximum tax from previous bracket plus 32% of the excess over $163,300 |
35% |
$207,351 to $518,400 | Maximum tax from previous bracket plus 35% of the excess over $207,350 |
37% |
$518,401+ | Maximum tax from previous bracket plus 37% of the excess over $518,400 |
Source: [[Federal Income Tax Brackets]]
Output
$ python3 IncomeTax2.py 50000 S
Federal Income Tax: $6790.00
$ python3 IncomeTax2.py 100000 M
Federal Income Tax: $13580.00
$ python3 IncomeTax2.py 200000 H
Federal Income Tax: $43574.00
$ python3 IncomeTax2.py 1000000 S
Federal Income Tax: $334427.00