Program Specifications: Write a program to calculate U.S. income tax owed given wages, taxable interest, unemployment compensation, status (single or married), and taxes withheld. Taxpayers are only allowed to use this short form if adjusted gross income (AGI) is less than $120000. Dollar amounts are displayed as integers with no comma separators. For example, cout << "Deduction: $" << deduction Step 1 . Input wages, taxable interest, unemployment compensation, status (1=single and 2=married), and taxes withheld as integers. Calculate and output AGI (wages + interest + unemployment). Output error message if AGI is above $120000 and the program stops with no additional output. Submit for grading to confirm two tests pass. Ex: If the input is: 20000 23 500 1 400 The output is: AGI: $20523 Ex: If the input is: 120000 23 500 1 400 The output is: AGI: $120523 Error: Income too high to use this form Step 2. Identify deduction amount based on status: (1) Single=$12000 or (2) Married=$24000. Set status to 1 if not input as 1 or 2. Calculate taxable income (AGI - deduction). Set taxable income to zero if negative. Output deduction and taxable income. Submit for grading to confirm five tests pass. Ex: If the input is: 20000 23 500 1 400 Ex: The additional output is: AGI: $20523 Deduction: $12000 Taxable income: $8523 Step 3. Calculate tax amount based on exemption and taxable income (see tables below). The tax amount should be stored as a double and rounded to the nearest whole number using round(). Submit for grading to confirm eight tests pass. Ex: If the input is: 20000 23 500 1 400 Ex: The additional output is: AGI: $20523 Deduction: $12000 Taxable income: $8523 Federal tax: $852 Step 4. Calculate the amount of tax due (tax - withheld). If the amount due is negative the taxpayer receives a refund. Output tax due or tax refund as positive values. Submit for grading to confirm all tests pass. Ex: If the input is: 80000 0 500 2 12000 Ex: The additional output is: AGI: $80500 Deduction: $24000 Taxable income: $56500 Federal tax: $6380 Tax refund: $5620

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

PLEASE ANSWER USING C++ 

Program Specifications: Write a program to calculate U.S. income tax owed given wages, taxable interest, unemployment compensation, status (single or married), and taxes withheld. Taxpayers are only allowed to use this short form if adjusted gross income (AGI) is less than $120000. Dollar amounts are displayed as integers with no comma separators. For example, cout << "Deduction: $" << deduction

Step 1 . Input wages, taxable interest, unemployment compensation, status (1=single and 2=married), and taxes withheld as integers. Calculate and output AGI (wages + interest + unemployment). Output error message if AGI is above $120000 and the program stops with no additional output. Submit for grading to confirm two tests pass.
Ex: If the input is:

20000 23 500 1 400

The output is:

AGI: $20523

Ex: If the input is:

120000 23 500 1 400

The output is:

AGI: $120523

Error: Income too high to use this form


Step 2. Identify deduction amount based on status: (1) Single=$12000 or (2) Married=$24000. Set status to 1 if not input as 1 or 2. Calculate taxable income (AGI - deduction). Set taxable income to zero if negative. Output deduction and taxable income. Submit for grading to confirm five tests pass.
Ex: If the input is:

20000 23 500 1 400

Ex: The additional output is:

AGI: $20523

Deduction: $12000

Taxable income: $8523


Step 3. Calculate tax amount based on exemption and taxable income (see tables below). The tax amount should be stored as a double and rounded to the nearest whole number using round(). Submit for grading to confirm eight tests pass.
Ex: If the input is:

20000 23 500 1 400

Ex: The additional output is:

AGI: $20523

Deduction: $12000

Taxable income: $8523 Federal tax: $852

Step 4. Calculate the amount of tax due (tax - withheld). If the amount due is negative the taxpayer receives a refund. Output tax due or tax refund as positive values. Submit for grading to confirm all tests pass.
Ex: If the input is:

80000 0 500 2 12000

Ex: The additional output is:

AGI: $80500

Deduction: $24000

Taxable income: $56500

Federal tax: $6380

Tax refund: $5620

Income
$0-$10000
$10001 - $40000
$40001 - $85000
over $85000
Income
$0-$20000
$20001 - $80000
over $80000
Tax for Single Filers
10% of the income
$1000+12% of the amount over $10000
$4600 + 22% of the amount over $40000
$14500 +24% of the amount over $85000
Tax for Married Filers
10% of the income
$2000+12% of the amount over $20000
$9200 + 22% of the amount over $80000
Transcribed Image Text:Income $0-$10000 $10001 - $40000 $40001 - $85000 over $85000 Income $0-$20000 $20001 - $80000 over $80000 Tax for Single Filers 10% of the income $1000+12% of the amount over $10000 $4600 + 22% of the amount over $40000 $14500 +24% of the amount over $85000 Tax for Married Filers 10% of the income $2000+12% of the amount over $20000 $9200 + 22% of the amount over $80000
1 #include <iostream>
2 #include <cmath>
3 using namespace std;
4
5 int main() {
6
7
8
9
10 }
11
/* Type your code here. */
return 0;
main.cpp
Transcribed Image Text:1 #include <iostream> 2 #include <cmath> 3 using namespace std; 4 5 int main() { 6 7 8 9 10 } 11 /* Type your code here. */ return 0; main.cpp
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Using the follow-up answer provided I am getting more errors than before. Can you please fix the errors? Thank you. 

This problem has now cost me 3 questions.

Output differs. See highlights below. Special character legend
Input 119000 0 3000 1 400
Your output
Expected output
8:Compare output
Input
Your output
Your output does not
contain
10:Compare output
Your output
Error: Income too high to use this form
Expected output
AGI: $122000*
Error: Income too high to use this form
99000 0 0 2 10000
AGI: $99000
Deduction: $24000
Taxable income: $75000
Federal tax: $11100
Tax due: $1100
Output differs. See highlights below.
Input
Federal tax: $8600
25000 1000 0 1 0
AGI: $26000
Deduction: $12000
Taxable income: $14000
Federal tax: $1400
Tax due: $1400
AGI: $26000
Deduction: $12000
Taxable income: $14000
Federal tax: $1480
Taxes Owed: $1480
Transcribed Image Text:Output differs. See highlights below. Special character legend Input 119000 0 3000 1 400 Your output Expected output 8:Compare output Input Your output Your output does not contain 10:Compare output Your output Error: Income too high to use this form Expected output AGI: $122000* Error: Income too high to use this form 99000 0 0 2 10000 AGI: $99000 Deduction: $24000 Taxable income: $75000 Federal tax: $11100 Tax due: $1100 Output differs. See highlights below. Input Federal tax: $8600 25000 1000 0 1 0 AGI: $26000 Deduction: $12000 Taxable income: $14000 Federal tax: $1400 Tax due: $1400 AGI: $26000 Deduction: $12000 Taxable income: $14000 Federal tax: $1480 Taxes Owed: $1480
Solution
Bartleby Expert
SEE SOLUTION
Follow-up Question

USING C++ can you please fix according to the errors received using your code? Thank you.

1 #include <iostream>
2 #include <math>
3 using namespace std;
4
5 int main() {
6
7 #include <<math>
8 using namespace std;
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Step 1: Input wage, if,tream>
54
55
56
57
58
59
60
61 }
// Calculate AGI
int AGI = wages + taxable_interest + unemployment_compensation;
// Check if AGI exceeds $120000 and output error message if true
if (AGI
120000) {
cout << "Error: Income too high to use this form" << endl;
return 0; // Stop the program
}
// Output AGI
cout << "AGI: $" <<AGI << endl;
// Step 2: Identify deduction amount based on status
int deduction = (status == 2) ? 24000 12000;
// Calculate taxable income
int taxable income = max(AGI - deduction, 0);
// Output deduction and taxable income
cout << "Deduction: $" << deduction << endl;
cout << "Taxable income: $" << taxable income << endl;
// Step 3: Calculate tax amount based on exemption and taxable income
double tax amount = 0.0;
if (taxable income <= 20000) {
tax_amount = taxable income * 0.1;
} else if (taxable income <= 5eeee) {
tax_amount = 2000 + (taxable income - 20000) * 0.12;
} else if (taxable income <= 75000) {
tax_amount = 2000 + 3600 + (taxable income - 50000) * 0.22;
} else {
tax_amount = 2000 + 3600 + 5500 + (taxable income - 75000) * 0.24;
}
// Round tax_amount to the nearest whole number using round() function
int rounded_tax_amount = round (tax_amount);
// Output the Federal tax amount
cout << "Federal tax: $" << rounded_tax_amount << endl;
// Step 4: Calculate the amount of tax due or refund
int tax due_or_refund = rounded_tax_amount - taxes_withheld;
// Output tax due or refund as positive values
if (tax_due_or_refund >= 0) {
cout << "Tax due: $" << tax_due_or_refund << endl;
} else {
cout << "Tax refund: $" << abs(tax_due_or_refund) << endl;
}
return 0;
Transcribed Image Text:1 #include <iostream> 2 #include <math> 3 using namespace std; 4 5 int main() { 6 7 #include <<math> 8 using namespace std; 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 // Step 1: Input wage, if,tream> 54 55 56 57 58 59 60 61 } // Calculate AGI int AGI = wages + taxable_interest + unemployment_compensation; // Check if AGI exceeds $120000 and output error message if true if (AGI 120000) { cout << "Error: Income too high to use this form" << endl; return 0; // Stop the program } // Output AGI cout << "AGI: $" <<AGI << endl; // Step 2: Identify deduction amount based on status int deduction = (status == 2) ? 24000 12000; // Calculate taxable income int taxable income = max(AGI - deduction, 0); // Output deduction and taxable income cout << "Deduction: $" << deduction << endl; cout << "Taxable income: $" << taxable income << endl; // Step 3: Calculate tax amount based on exemption and taxable income double tax amount = 0.0; if (taxable income <= 20000) { tax_amount = taxable income * 0.1; } else if (taxable income <= 5eeee) { tax_amount = 2000 + (taxable income - 20000) * 0.12; } else if (taxable income <= 75000) { tax_amount = 2000 + 3600 + (taxable income - 50000) * 0.22; } else { tax_amount = 2000 + 3600 + 5500 + (taxable income - 75000) * 0.24; } // Round tax_amount to the nearest whole number using round() function int rounded_tax_amount = round (tax_amount); // Output the Federal tax amount cout << "Federal tax: $" << rounded_tax_amount << endl; // Step 4: Calculate the amount of tax due or refund int tax due_or_refund = rounded_tax_amount - taxes_withheld; // Output tax due or refund as positive values if (tax_due_or_refund >= 0) { cout << "Tax due: $" << tax_due_or_refund << endl; } else { cout << "Tax refund: $" << abs(tax_due_or_refund) << endl; } return 0;
Failed to compile
main.cpp: In function 'int main()':
main.cpp:11:15: error: 'wages' was not declared in this scope
11 I
int AGI = wages + taxable_interest + unemployment_compensation;
main.cpp:11:23: error: 'taxable_interest' was not declared in this scope
11 I int AGI = wages + taxable interest + unemployment_compensation;
Po në na na na na na na na na na na na na na
I
main.cpp:11:42: error: unemployment_compensation' was not declared in this scope
11 I
int AGI = wages + taxable_interest + unemployment_compensation;
nementene na në në të në he të he të tëhe të he të tẻ th
main.cpp:23:22: error: 'status' was not declared in this scope; did you mean 'static'?
23 1 int deduction = (status == 2) ? 24000 12000;
1
I
static
main.cpp:51:50: error: '`taxes_withheld' was not declared in this scope
51 1
int tax_due_or_refund = rounded_tax_amount - taxes_withheld;
I
Transcribed Image Text:Failed to compile main.cpp: In function 'int main()': main.cpp:11:15: error: 'wages' was not declared in this scope 11 I int AGI = wages + taxable_interest + unemployment_compensation; main.cpp:11:23: error: 'taxable_interest' was not declared in this scope 11 I int AGI = wages + taxable interest + unemployment_compensation; Po në na na na na na na na na na na na na na I main.cpp:11:42: error: unemployment_compensation' was not declared in this scope 11 I int AGI = wages + taxable_interest + unemployment_compensation; nementene na në në të në he të he të tëhe të he të tẻ th main.cpp:23:22: error: 'status' was not declared in this scope; did you mean 'static'? 23 1 int deduction = (status == 2) ? 24000 12000; 1 I static main.cpp:51:50: error: '`taxes_withheld' was not declared in this scope 51 1 int tax_due_or_refund = rounded_tax_amount - taxes_withheld; I
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education