47.0k views
3 votes
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
(O=dependent, 1=single, and 2=married), and taxes withheld. Step 2 . Complete the calc_AGIO 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 cal_AGIO and outputs the
returned value. Submit for grading to confirm two tests pass.
Ex: If the input is:
20000 23 500 1 400
The output is:
AGI: $20,523
Step 3 . 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

1 Answer

5 votes

Final answer:

The student is asked to incrementally create a program to calculate U.S. income tax based on various inputs. The first steps include obtaining the inputs, calculating the adjusted gross income, and determining standard deductions based on filing status.

Step-by-step explanation:

The student's question pertains to writing a program that calculates U.S. income tax based on various inputs such as wages, taxable interest, unemployment compensation, filing status, and taxes withheld. Step by step, the student needs to develop the program incrementally, beginning with taking inputs, then calculating the adjusted gross income (AGI), and subsequent to that, determining the standard deduction based on the filing status. As the student progresses, they will confirm passing the tests after each step to ensure the program is correctly developed.

To calculate adjusted gross income, one would sum the absolute values of wages, taxable interest, and unemployment compensation. The taxable income would then be the AGI minus any deductions and exemptions applicable, based on the tax filer's status which could be dependent, single, or married. Understanding tax tables and the concept of tax brackets is crucial to accurately calculating the taxes owed.

User Samir Sadek
by
8.4k points