18.5 Project 5: Income tax form - functions Program Specifications Write a program to calculate U.S. income tax owed giv
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
18.5 Project 5: Income tax form - functions Program Specifications Write a program to calculate U.S. income tax owed giv
Ex: If the input is: 20000 23 500 1 400 The additional output is: AGI: $20,523 Deduction: $12,000 Taxable income: $8,523 Step 5 (2 pts). Complete the calc_tax(function. Calculate tax amount based on status and taxable income (see tables below). Tax amount should be stored initially as a double then rounded to the nearest whole number using round(). Within the main portion of the code call calc_tax() and output the returned value. Submit for grading to confirm eight tests pass. Ex: If the input is: 50000 0 02 5000 The additional output is: AGI: $50,000 Deduction: $24,000 Taxable income: $26,000 tax: $2,7 Income Tax for Dependent or Single Filers SO - $10,000 10% of the income $10,001 - $40,000 $1,000 + 12% of the amount over $10,000 $40,001 - $85,000 $4,600 + 22% of the amount over $40,000 over $85,000 $14,500 +24% of the amount over $85,000 Income Tax for Married Filers SO - $20,000 10% of the income $20,001 - $80,000 $2,000 + 12% of the amount over $20,000 over $80,000 $9,200 + 22% of the amount over $80,000
Step 6 (2 pts). Complete the calc_tax_due() function. Set withheld parameter to zero if negative to correct potential input error. Calculate and return amount of tax due (tax - withheld). Within the main portion of the code call calc_tax_due() and output returned value. Submit for grading to confirm all tests pass. Ex: If the input is: 80000 0 500 2 12000 The additional output is: AGI: $80,500 Deduction: $24,000 Taxable income: $56,500 Federal tax: $6,380 Tax due: $-5, 620 375418.2407546.qx3zay7 LAB ACTIVITY 18.5.1: Project 5: Income tax form - functions 4/10 main.py Load default template... 1 # Calculate AGI and repair any negative values 2 def calc_AGI (wages, interest, unemployment): 3 return -1 4 5 # Calculate deduction depending on single, dependent or married 6 def get_deduction (status): 7 return -1 8 9 # Calculate taxable but not allow negative results 10 def calc_taxable(agi, deduction): 11 return -1 12 13 # Calculate tax for single or dependent 14 def calc_tax(status, taxable): 15 return -1 16 17 # Calculate tax due and check for negative withheld 18 def calc_tax_due (tax, withheld): 19 return -1 20 21 if _name _main__': 22 # Step #1: Input wages, interest, unemployment, status, withheld 23 24 # Step $2: Calculate AGI 25 agi = calc_AGI (wages, interest, unemployment) 26 print("AGT: ${agi:,}") 27 ==