Question
WHAT I NEED IS ONLY AN ARRAY THAT WOULD ALLOW THE USER TO CHOOSE BETWEEN USING THE STANDARD DEDUCTION METHOD OR THE ITEMIZED METHOD TO
WHAT I NEED IS ONLY AN ARRAY THAT WOULD ALLOW THE USER TO CHOOSE BETWEEN USING THE STANDARD DEDUCTION METHOD OR THE ITEMIZED METHOD TO FILE THEIR TAXES. THIS IS THE ONLY CODE SECTION THAT HAS TO BE MODIFIED BUT I DONT KNOW HOW TO DOIT
///// input deductions ////
double inputDeductions(int taxpayerStatus)
{
double deductions;
cout << "Enter the amount of your Itemized Deductions: ";
cin >> deductions;
return deductions;
}
Any information needed is in the description, the sample code and the taxpayer status standard deduction table
PROJECT DESCRIPTION:When people fill out their tax return, they have the option of itemizing their deductions or using a standard deduction. If people are buying a house and have a mortgage, have donated a lot of money to charities, have high medical bills or other deductions, it may be better to itemize and list all their deductions. For many people it may be better to take the 'standard deduction' The program should ask for the following information in this order: a) Tax status - single, married filing jointly, etc.b) Number of exemptions (people you can claim on your taxes 1, 2, 3, etc.)c) Total income in dollarsd) Select either standard deduction or itemized deduction 1.
If the standard deduction is selected, the amount is to be looked up from an array. The array is to filled with the data shown in the table below. 2. If the itemized deduction is selected, the dollar amount of the deduction is to be read from the keyboar a) Income in dollarsb) -Exemptions in dollarsc) -Deductions in dollarsd) Taxable income e) Computed tax in dollars (from the tax tables)f) -Amount withheld in dollars (usually from the W2 from your employer)g) Refund or amount owed in dollars When all the data has been collected, the program displaysI have completed most of the code for the Tax Estimator project. The program needs to be updated to ask if the the user wants to itemize or use the standard deduction. If the user selects to itemize, then the program is to ask for the itemized deductions. If the user selects the standard deduction, then the program looks up the amount of deduction from an array, based on the filing status (single, married, etc.) The project currently allows the user to input the amount of the itemized deductions, but the program has not been completed to use the standard deductions. If the standard deduction option is selected when running the program, the deductions should place the standard deductions in an array and look up the deduction from the array. The array is to be filled with the following data:
Taxpayer Status Standard Deduction =========================================
Single 6300.00 Married filing jointly 12600.00 Married filing separately 6300.00 Head of Household 9250.00
Qualifying Widow(er) 12600.00
This is part of the code but I need the rest
/ C++TaxEstimator.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include#include using namespace std; enum taxStatus { Single = 1, MarriedFilingJointly, MarriedFilingSeparately, HeadOfHousehold, QualifyingWidow // or Widower }; struct taxTable { double from; double to; double tax; double percent; }; const double exemptionRate = 4000.00; const int bracketCount = 7; int inputStatus(); int inputExemptions(); double inputIncome(); double inputDeductions(int); double standardDeduction(int); double computedTax(int, double taxableIncome); taxTable *tableSelection(int); int main(int argc, char* argv[]) { int status; double totalIncome; int exemptions; double deductions; double taxableIncome; double tax; double withholding; double refundOrTaxDue; cout << "FEDERAL TAX ESTIMATOR" << endl; cout << "The data in this project is from a previous tax year. Tax tables" << endl; cout << "are adjusted each year due to inflation and legal changes. The" << endl; cout << "output from this program is for information purposes only." << endl << endl; do { // input the data status = inputStatus(); // input the tax payer status (1-5) if (status == 0) break; // end the program exemptions = inputExemptions(); totalIncome = inputIncome(); deductions = inputDeductions(status); // taxpayer status to inputDeductions cout << "Enter the amount withheld: "; cin >> withholding; // compute the tax taxableIncome = totalIncome - exemptions*exemptionRate - deductions; if (taxableIncome < 0) taxableIncome = 0; tax = computedTax ((taxStatus)status, taxableIncome); refundOrTaxDue = withholding - tax; // display the results cout << setiosflags(ios::fixed | ios::showpoint) << endl; cout << setprecision(2); cout << endl; cout << "Income: " << setw(9) << totalIncome << endl; cout << "Exemptions: " << setw(9) << -exemptions * exemptionRate << endl; cout << "Deductions: " << setw(9) << -deductions << endl; cout << "--------------------------" << endl; cout << "Taxable Income: " << setw(9) << taxableIncome << endl << endl; cout << "Tax Estimate: " << setw(9) << tax << endl; cout << "Withholding: " << setw(9) << withholding << endl; if (refundOrTaxDue >= 0) cout << "Estimated refund:" << setw(9) << refundOrTaxDue << endl; else cout << "Please pay: " << setw(9) << -refundOrTaxDue << endl; cout << endl; } while (status >=1 && status <= 5); return 0; } ////// input taxpayer status (0-5) //// int inputStatus() { int status; do { cout << "=======================================================" << endl; cout << "Enter your tax status:" << endl << "1 = Single" << endl << "2 = Married filing jointly" << endl << "3 = Married filing separately" << endl << "4 = Head of Household" << endl << "5 = Qualifying widow(er)" << endl << "0 = END THE PROGRAM" << endl << "> "; cin >> status; if (cin.fail() || status < 0 || status > 5) cout << "Illegal value, try again" << endl; } while (status < 0 || status > 5); return status; } ////// input exemptions //// int inputExemptions() { int exemptions; cout << "Enter the number of exemptions: (you + dependants): "; cin >> exemptions; return exemptions; } ////// input income //// double inputIncome() { double income; cout << "Enter your total income: "; cin >> income; return income; } ////// input deductions //// double inputDeductions(int taxpayerStatus) { double deductions; cout << "Enter the amount of your Itemized Deductions: "; cin >> deductions; return deductions; } // The asterisk * indicates that a pointer is to be returned. taxTable *tableSelection (int s) { const double maxDouble = 1E12; // just some big number = 1 * 10^12 //from to tax percent static taxTable SingleTaxTable[] = { {0.00, 9225.00, 0.00, 10.0}, {9225.00, 37450.00, 922.50, 15.0}, {37450.00, 90750.00, 5156.25, 25.0}, {90750.00, 189300.00, 18481.25, 28.0}, {189300.00, 411500.00, 46075.25, 33.0}, {411500.00, 413200.00, 119401.25, 35.0}, {413200.00, maxDouble, 119996.25, 39.6} }; static taxTable MarriedFilingJointlyTaxTable[] = { {0.00, 18450.00, 0.00, 10.0}, {18450.00, 74900.00, 1845.00, 15.0}, {74900.00, 151200.00, 10312.50, 25.0}, {151200.00, 230450.00, 29387.50, 28.0}, {230450.00, 411500.00, 51577.50, 33.0}, {411500.00, 464850.00, 111324.00, 35.0}, {464850.00, maxDouble, 129996.50, 39.6} }; static taxTable MarriedFilingSeparatelyTaxTable[] = { {0.00, 9225.00, 0.00, 10.0}, {9225.00, 37450.00, 922.50, 15.0}, {37450.00, 75600.00, 5156.25, 25.0}, {75600.00, 115225.00, 14693.75, 28.0}, {115225.00, 205750.00, 25788.75, 33.0}, {205750.00, 232425.00, 55662.00, 35.0}, {232425.00, maxDouble, 64998.25, 39.6} }; static taxTable HeadOfHouseholdTaxTable[] = { {0.00, 13150.00, 0.00, 10.0}, {13150.00, 50200.00, 1315.00, 15.0}, {50200.00, 129600.00, 6872.50, 25.0}, {129600.00, 209850.00, 26772.50, 28.0}, {209850.00, 411500.00, 49192.50, 33.0}, {411500.00, 439000.00, 115737.00, 35.0}, {439000.00, maxDouble, 125362.00, 39.6} }; static taxTable QualifyingWidowTaxTable[] = { {0.00, 18450.00, 0.00, 10.0}, {18450.00, 74900.00, 1845.00, 15.0}, {74900.00, 151200.00, 10312.50, 25.0}, {151200.00, 230450.00, 29387.50, 28.0}, {230450.00, 411500.00, 51577.50, 33.0}, {411500.00, 464850.00, 111324.00, 35.0}, {464850.00, maxDouble, 129996.50, 39.6} }; switch (s) { // return a pointer to the table based on the filing status case Single: return SingleTaxTable; case MarriedFilingJointly: return MarriedFilingJointlyTaxTable; case MarriedFilingSeparately: return MarriedFilingSeparatelyTaxTable; case HeadOfHousehold: return HeadOfHouseholdTaxTable; case QualifyingWidow: return QualifyingWidowTaxTable; default: return NULL; }; return NULL; } double computedTax (int s, double taxableIncome) { taxTable *table = tableSelection(s); double baseTax; double tax=0.0; // find the entry in the tax table for (int i=0; i table[i].from && taxableIncome<=table[i].to) { baseTax = table[i].tax; tax = baseTax + (taxableIncome - table[i].from)*table[i].percent/100.0; } } return tax; }
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