Question: UNIV199 Introduction to Programming with Python Homework #2 Due: March 3, 2021, Wednesday, 23:59. Conditional Statements In this homework, you are going to calculate the
UNIV199 Introduction to Programming with Python
Homework #2
Due: March 3, 2021, Wednesday, 23:59.
Conditional Statements
In this homework, you are going to calculate the tax amount according to persons marital status, income, and the number of children.
- First, the program should ask the users marital status (Single=0/Married=1), income, and the number of children.
- Then, your program should calculate the tax amount using the information given in the table below:
- If the person is single:
Table 1 Tax calculation formula for single
| Income | Single |
| 24450.0 | income x 0.15 |
| 52300.0 | 24450.0 x 0.15 + (income - 24450.0) x 0.25 |
| > 52300.0 | 24450.0 x 0.15 + (52300.0 - 24450.0) x 0.25 + (income 52300.0) x 0.31 |
- If the person is married:
Table 2 Tax calculation formula for married
| Income | Married |
| 37800.0 | income x 0.15 |
| 87500.0 | 37800.0 x 0.15 + (income - 37800.0) x 0.25 |
| > 87500.0 | 37800.0 x 0.15 + (87500.0 - 37800.0) x 0.25 + (income 87500.0) x 0.31 |
- The government deducts taxes according to number of children the person has. Deduction amounts are calculated according to marital status and the number of children:
Table 3 Tax deductions
| Number of children | Single | Married |
| Less than 3 | $200 per child | $250 per child |
| 3 or more | $350 per child | $400 per child |
- Sample outputs for all possible cases are given below:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
