Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have been running into nothing but issues with this. Any help I find does not

ID: 3555702 • Letter: I

Question

I have been running into nothing but issues with this. Any help I find does not seem to address my problems. This question is in Chegg but the answers provided do not work and were way off of what I had originally had. I know where my issues are but not sure how to address them.

Here is the question:

Write a program that can be used to calculate the federal tax. The tax is
calculated as follows: For single people, the standard exemption is $4,000; for
married people, the standard exemption is $7,000. A person can also put up
to 6% of his or her gross income in a pension plan. The tax rates are as
follows: If the taxable income is:

Explanation / Answer

#include <iostream>

using namespace std;

void getData (char &ms, int &ks, double &sa, double &pe)
{
   cout << "Enter marital status: (m for married and s for single)" << endl;
   cin >> ms;

   if (ms == 'm')
   {
       cout << "Enter number of children under the age of 14: " << endl;
       cin >> ks;
   }

   cout << "Enter income: " << endl;
   cin >> sa;

   cout << "Enter percent of pension: " << endl;
   cin >> pe;
}

double taxAmount (char ms, int ks, double sa, double pe)
{
   double taxable, tax;

   if (ms == 's')
   {
       taxable = sa - 4000 - (sa * pe) - 1500;

       if (taxable <= 15000)
           tax = taxable * 0.15;
       else if (taxable > 15000 && taxable <= 40000)
           tax = ((taxable - 15000) * 0.25) + 2250;
       else
           tax = ((taxable - 40000) * 0.35) + 8460;
   }
   else if (ms == 'm')
   {
       taxable = sa - 4000 - (sa * pe) - (1500 * ks);

       if (taxable <= 15000)
           tax = taxable * 0.15;
       else if (taxable > 15000 && taxable <= 40000)
           tax = ((taxable - 15000) * 0.25) + 2250;
       else
           tax = ((taxable - 40000) * 0.35) + 8460;
   }
   return tax;
}

int main()
{
   char marital = 's';
   int children = 0;
   double salary = 0.0;
   double pension = 0.0;

   getData (marital, children, salary, pension);


   cout << "Marital status: " << marital << endl;
   cout << "Children under 14: " << children << endl;
   cout << "Total income: " << salary << endl;
   cout << "Pension percentage: " << pension << endl;
   cout << "Tax amount $" << taxAmount (marital, children, salary, pension);
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote