Welcome to Westonci.ca, where you can find answers to all your questions from a community of experienced professionals. Join our platform to connect with experts ready to provide precise answers to your questions in various areas. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.

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 (O=dependent, 1 =single, and 2=married), and taxes withheld. Step 2 (2 pts). 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 calc_ 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 (2 pts). Complete the get_deduction() function. Return the deduction amount based on status: () 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 0 2 5000 The additional output is: AGI: $50,000 Deduction: $24,000 Taxable income: $26,000 Federal tax: $2,720 Income Tax for Dependent or Single Filers $0 - $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 $0-$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

Sagot :

Answer:In this project, you are tasked with creating a program that calculates the U.S. income tax owed based on the following inputs: wages, taxable interest, unemployment compensation, status (dependent, single, or married), and taxes withheld. Your program should follow the specifications provided in the prompt and complete each of the six steps outlined in the prompt.

In step 1, you are asked to input the necessary information for your program to calculate the income tax owed. This includes the wages, taxable interest, unemployment compensation, and taxes withheld.

In step 2, you are asked to complete the calc_AGIO function, which calculates the adjusted gross income (AGI) by summing the wages, interest, and unemployment compensation. Any negative values should be converted to positive before summing to correct potential input errors. The function should return the AGI.

In step 3, you are asked to complete the get_deduction function, which returns the deduction amount based on the status of the individual (dependent, single, or married). The deduction amount should be $6,000 for a dependent, $12,000 for a single individual, and $24,000 for a married individual. If the status is anything but 0, 1, or 2, the function should return $6,000.

In step 4, you are asked to complete the get_taxable function, which calculates the taxable amount by subtracting the deduction amount from the AGI. If the calculation results in a negative value, the taxable amount should be set to zero. The function should return the taxable amount.

In step 5, you are asked to complete the calc_tax function, which calculates the tax amount based on the status and taxable income of the individual. The tax amount should be stored initially as a double, then rounded to the nearest whole number using the round function. The function should return the tax amount.

In step 6, you are asked to complete the calc_tax_due function, which calculates and returns the amount of tax due by subtracting the taxes withheld from the tax amount. If the withheld parameter is negative, it should be set to zero to correct potential input errors.

Once you have completed all of the steps and functions, your program should be able to take the necessary inputs and output the AGI, deduction amount, taxable income, federal tax, and tax due, as specified in the prompt.

Explanation: