Demonstrate your understanding of solving problems that involve using loops and decisions in programs.
Write a Python program to use loops and decisions.
Use Python for the following problem helping an IRS agent to calculate income tax based on user income and filing status. We will use loops to process more than one set of input values.
Income | Filing as Single | Tax Due |
From | To | |
$0 | $50,000 | 10% of income |
More than $50,000 | $100,000 | $2500 + 12% of amount over $50,000 |
More than $100,000 | ... | $6000 + 15% of amount over $100,000 |
Income | Filing as married | Tax Due |
From | To | |
$0 | $50,000 | 5% of income |
More than $50,000 | $100,000 | $2500 + 8% of amount over $50,000 |
More than $100,000 | ... | $6000 + 10% of amount over $100,000 |
Display the following information in a format very close to the following sample run. For example, you need to display the labels as stated, below. Make sure to test for all possible cases to assure your program is functioning properly.
Number of people: -1
ERROR - try again,
Number of people: 30
ERROR - try again,
Number of people: 4
Filing status: single
Income: 60000
Filing status: single
Income: $60000.00
Tax: $3700.00 <): 2500+0.12*(60000 - 50000)
Filing status: joint
Invalid filing status - try again
Filing status: married
Income: 150000
Filing status: married
Income: $150000.00
Tax: $11000.00 <): 6000+0.1*(150000 - 100000)
Filing status: single
Income: 20000
Filing status: single
Income: $20000.00
Tax: $2000.00 <): 0.1*20000
Grand Total of income = $230000.00
Grand Total of tax = $16700.00