Question: Write a program that can be used to calculate the federal tax. this is what i have so far, what do i need to fix,

Write a program that can be used to calculate the federal tax.
this is what i have so far, what do i need to fix, and how should i call my functions to the main function:
#include
#include
#include
using namespace std;
void getData(char mStatus, int numOfPpl, double grossSalary, double pensionFund)
{
int children =0;
cout << "Enter M for married or S for single: ";
cin >> mStatus;
if(toupper(mStatus =='M'))
{
cout << "Enter number of childer under 14: ";
cin >> children;
numOfPpl =2+ children;
}
else
{
numOfPpl =1;
}
cout <<" Enter gross salary: ";
cin >> grossSalary;
cout << "Enter pension fund up to 6%: ";
cin >> pensionFund;
if (pensionFund >0|| pensionFund <6.00)
{
pensionFund =(pensionFund * grossSalary)/100;
}
else
{
cout << "Wrong number enterd. Enter a number up to 6%";
}
cout << endl;
}
double taxAmount(char mStatus, int numOfPpl, double grossSalary, double pensionFund)
{
double standardExemption=0;
double personalExemption =0;
if (mStatus =='M'|| mStatus =='M')
{
standardExemption =7000;
personalExemption =1500.0* numOfPpl;
}
else
{
standardExemption =4000;
}
double taxableIncome = grossSalary -(standardExemption + pensionFund + personalExemption);
double tax;
if (taxableIncome <=15000)
{
tax = taxableIncome *15;
}
else if (taxableIncome <=40000)
{
tax =2250.0+(taxableIncome -15000)*25;
}
else
{
tax =8460.0+(taxableIncome -40000)*35;
}
}
int main()
{
char mStatus='';
int numOfPpl =0;
double grossSalary =0, pension =0;
double federalTax =0, taxableIncome =0;
cout << fixed << showpoint << setprecision(2);
cout << "Marital Status: "<< mStatus << endl;
cout << "Income earned: $"<< grossSalary << endl;
cout << "Pension Plan Contribution: $"<< pension << endl;
cout <<"
Taxable Income: $"<< taxableIncome << endl;
cout << "The federal tax payable is: $"<< federalTax << endl;
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!