
PLEASE USE C++ AND CORRECT THE CODE ERROR USING YELLOW HIGHLIGHTED ERRORS IN ATTACHED PHOTO
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
Note: this program is designed for incremental development. Complete each step and submit it for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.
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:
The output is:
AGI: $20523Ex: If the input is:
120000 23 500 1 400The output is:
AGI: $120523Step 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:
Ex: The additional output is:
AGI: $20523
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:
Ex: The additional output is:
AGI: $20523Income | Tax for Single Filers |
---|---|
$0 - $10000 | 10% of the income |
$10001 - $40000 | $1000 + 12% of the amount over $10000 |
$40001 - $85000 | $4600 + 22% of the amount over $40000 |
over $85000 | $14500 + 24% of the amount over $85000 |
Income | Tax for Married Filers |
---|---|
$0 - $20000 | 10% of the income |
$20001 - $80000 | $2000 + 12% of the amount over $20000 |
over $80000 | $9200 + 22% of the amount over $80000 |
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:
Ex: The additional output is:
AGI: $80500#include <iostream>
#include <cmath>
using namespace std;
int main() {
int wages, taxable_interest, unemployment_compensation, status, taxes_withheld;
cin >> wages >> taxable_interest >> unemployment_compensation >> status >> taxes_withheld;
int AGI = wages + taxable_interest + unemployment_compensation;
if (AGI > 120000) {
cout << "Error: Income too high to use this form" << endl;
return 0;
}
cout << "AGI: $" << AGI << endl;
int deduction = (status == 2) ? 24000 : 12000;
int taxable_income = max(AGI - deduction, 0);
cout << "Deduction: $" << deduction << endl;
cout << "Taxable income: $" << taxable_income << endl;
double tax_amount = 0.0;
if (taxable_income <= 20000) {
tax_amount = taxable_income * 0.1;
} else if (taxable_income <= 50000) {
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;
}
int rounded_tax_amount = round(tax_amount);
cout << "Federal tax: $" << rounded_tax_amount << endl;
int tax_due_or_refund = rounded_tax_amount - taxes_withheld;
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;
}



Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 4 images

Could you please fix the yellow highlighted errors in attachedment? The expected output is not correct.

Could you please fix the yellow highlighted errors in attachedment? The expected output is not correct.

- PYTHON!!! The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are 5% of the listed purchase price, minus the down payment. Write a program that takes the purchase price as input. The program should display a table, with appropriate headers, of a payment schedule for the lifetime of the loan. Each row of the table should contain the following items: The month number (beginning with 1) The current total balance owed The interest owed for that month The amount of principal owed for that month The payment for that month The balance remaining after payment The amount of interest for a month is equal to balance × rate / 12. The amount of principal for a month is equal to the monthly payment minus the interest owed. An example of the program input and output is shown below: Enter the puchase price: 200 (SEE IMAGE FOR PURCHASE PRICE CHART) Results you should get: Input: 200 Output: Purchase price: 200…arrow_forwarder 6 Functions Programming Exercises te 1. Rectangle Area ngle Area The area of a rectangle is calculated according to the following formula: Area = Width X Length Design a function that accepts a rectangle's width and length as arguments and returns the rectangle's area. Use the function in a program that prompts the user to enter the rectangle's width and length, and then displays the rectangle's area.arrow_forwardPART I: Functions – Math Test Write the Flowchart and Python code for the following programming problem based on the pseudocode below. Write a program that will allow a student to enter their name and then ask them to solve 10 mathematical equations. The program should display two random numbers that are to be added, such as: 247 + 129 The program should allow the student to enter the answer. The program should then display whether the answer was right or wrong, and accumulate the correct values. After the 10 questions are asked, calculate the average correct. Then display the student name, the number correct, and the average correct in both decimal and percentage format. In addition to any system functions you may use, you might consider the following functions: A function that allows the student to enter their name. A function that gets two random numbers, anywhere from 1 to 500. A function that displays the equation and asks the user to enter their answer. A function that…arrow_forward
- Please draw the flowchart for this code,I need under a few minutes please,it immediate and urgent #include int main() { int firstTerm, secondTerm, thirdTerm; std::cout << "Enter the first term: "; std::cin >> firstTerm; std::cout << "Enter the second term: "; std::cin >> secondTerm; std::cout << "Enter the third term: "; std::cin >> thirdTerm; int commonDifference = secondTerm - firstTerm; int sum = (300 * (2 * firstTerm + (300 - 1) * commonDifference)) / 2; std::cout << "Sum of the first 300 terms: " << sum << std::endl; std::cout << "The first fifty terms are: "; for (int i = 0; i < 50; i++) { std::cout << firstTerm + i * commonDifference << " "; } return 0; }arrow_forwardSurface Area of sphere is A = 4 π r **2 Convert this into function and pass any value of radius to display area of spherearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





