18.5 Project 5: Income tax form - functions Program Specifications Write a program to calculate U.S. income tax owed giv

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
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

Post by answerhappygod »

18 5 Project 5 Income Tax Form Functions Program Specifications Write A Program To Calculate U S Income Tax Owed Giv 1
18 5 Project 5 Income Tax Form Functions Program Specifications Write A Program To Calculate U S Income Tax Owed Giv 1 (93.82 KiB) Viewed 81 times
18.5 Project 5: Income tax form - functions Program Specifications Write a program to calculate U.S. income tax owed given wages, taxable interest, unemployment compensation, status (dependent, single, or married), and taxes withheld. Dollar amounts are displayed as integers with comma separators. For example, print(f"Deduction: ${deduction:,}"). Note: this program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress. Step 1. Within the main portion of the code, input the wages, taxable interest, unemployment compensation, status (0-dependent, 1=single, and 2=married), and taxes withheld. Step 2 (2 pts). Complete the calc_AGI() function. Calculate the adjusted gross income (AGI) that is the sum of wages, interest, and unemployment. Convert any negative values to positive before summing to correct potential input errors. Return the AGI. Note the provided code in the main portion of the code calls calc_AGIO and outputs the returned value. Submit for grading to confirm two tests pass. Ex: If the input is: 20000 23 500 i 400 The output is: AGI: $20,523 Step 3 (2 pts). Complete the get_deduction() function. Return the deduction amount based on status: (0) dependent = 6000, (1) single = 12000, or (2) married=24000. Return 6000 if the status is anything but 0, 1, or 2. Within the main portion of the code call get_deduction) and output the returned value. Submit for grading to confirm four tests pass. Ex: If the input is: 20000 23 500 1 400 The additional output is: AGI: $20,523 Deduction: $12,000 Step 4 (2 pts). Complete the get_taxable() function. Calculate taxable amount (AGI - deduction). Set taxable to zero if calculation results in negative value. Return taxable value. Within the main portion of the code call get_taxable() and output the returned value. Submit for grading to confirm six tests pass.

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 ==
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply