Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The code given is: /** * This program computes income taxes based on adjusted * gross income and a child tax credit. * */ #include
The code given is:
/** * This program computes income taxes based on adjusted * gross income and a child tax credit. * */ #includeThe federal income tax for a married couple filing jointly for 2021 is determined by the rules indicated in the following table. In addition, the total tax is reduced by $2,000 for each child that a couple has but cannot make the tax liability less than zero (for the purposes of this exercise). We have provided a partially completed program that reads in a user's Adjusted Gross Income (AGI) and prompts whether or not they have any children. If they do it prompts them for how many. Complete the program by computing the user's total tax based on the user's AGI the number of children they have. Some example input/output results can be found in the following table. For example, if the user has an adjusted gross income of $150,000 and has 4 children, then their tax would be calculated as follows. - Their AGI falls in the 3rd tax bracket and so would be $9,328+22% of the amount over $81,050 or $9,328+22%($150,000$81,050)=$24,497.00 - With 4 children, they have a $8,000 tax credit giving a new total of $16,497.00#include int main(int argc, char **argv) { double agi = 0.0; char c = 'N'; double tax = 0.0; double childCredit = 0.0; double totalTax = 0.0; int numChildren = 0; printf("Please enter your adjusted gross income (AGI): "); scanf("%lf", &agi); //remove the "enter" endline character getchar(); printf("Do you have any children? (Y) or (N)? "); c = getchar(); if(c == 'y' || c == 'Y') { printf("How many children do you have? "); scanf("%d", &numChildren); } //TODO: compute the tax, child credit, and total tax here printf("AGI: $%10.2f ", agi); printf("Tax: $%10.2f ", tax); printf("Child Credit: $%10.2f ", childCredit); printf("Total Tax: $%10.2f ", totalTax); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started