#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

void getData(char marital, int numberofKids, int& exempt, int& numberofPeople, double& grossSalary, double& penAmt);
double taxAmount(double taxIncome, int perExempt, double taxRate);

int main()

{      
	double grossSalary;
	double penAmt;     
	int numberofPeople;    
    char marital;
	int numberofKids;
	int exempt;
    double taxIncome;   
	double taxRate;   



	getData(marital, numberofKids, exempt, numberofPeople, grossSalary, penAmt);
	double taxAmount(double, int, double);

	
	cout << "Your federal tax owed is: " << taxRate << endl;

    return 0;
}	
	

{

	void getData(char marital, int numberofKids, int& exempt, int& numberofPeople, double& grossSalary, double& penAmt)
	
    char marital;      
    int numberofKids;      
	

	cout << fixed << showpoint;
	cout << setprecision(2);

    cout << "Enter your marital status: 'M' for Married or 'S' for Single: ";
	cin >> marital;
	cout << endl;

	if (marital == 'M' || marital == 'm')
	{
		
		cout << "Enter number of children under the age of 14 years: ";
		cout <<endl;
		cin >> numberofKids;
		exempt = 7000;
		numberofPeople = 2 + numberofKids;
	}
	else if (marital == 'S' || marital == 's')
	{		
		exempt = 4000;
        numberofKids = 0;
		numberofPeople = 1;
	}


		cout << "Enter combined gross salary. (The combined amount for both spouses";
		cout << "if married): ";
		cout << endl;
		cin >> grossSalary;

		cout << "Enter the percentage of your gross income which you have";

		cout << " contribute to a pension fund (Only enter the amount if amount if 6%";
		cout << " or less of your combined gross income: ";
		cout << endl;
		cin >> penAmt;

	if (penAmt > 6)
	{ 
			cout << "You may only enter a percentage which is great or equal to 6";
			cout  << "Enter the percentage of your gross income that you have contributed";
				cout << " to a pension fund. (only enter up to6%";
				cin >> penAmt;

	}

		
	
}

{

  double taxAmount(double taxRate, int perExempt, int numberofPeople, double taxRate)

	double taxRate;  
    double taxAmt;   
	int perExempt;      
	double taxRate;
	double taxIncome;
	double& grossSalary;
	double& penAmt;
    int exempt;


	taxRate = 0;
	
	perExempt = (numberofPeople * 1500) + exempt;
	taxIncome = grossSalary - (grossSalary * (penAmt * .01)) - perExempt);

	if (taxIncome <= 15000)
	{taxRate = .15 * taxIncome;
	}
	else if (taxIncome > 15000 && taxIncome <= 40000)
	{taxRate = ((taxIncome - 15000) * .25) + 2250;}
	else{
		taxRate = ((taxIncome - 40000) * .35) + 8460;
	}

	return taxRate;
	
	
}

Below are the errors.

(34) error C2447: '{' : missing function header (old-style formal l
ist?)
(91) error C2447: '{' : missing function header (old-style formal l
ist?)

Recommended Answers

All 2 Replies

You are missing a '{' between these lines.

double taxAmount(double taxRate, int perExempt, int numberofPeople, double taxRate)

	double taxRate;

>>You are missing a '{' between these lines.
He is actually misplacing '{'.
The defination of function in C++ is :

<return_type>     <function_name>([parameteres])
{
    //codes
}

rather than

{
<return_type>     <function_name>([parameteres])

    //codes
}

So make your definition as:

double taxAmount(double taxRate, int perExempt, int numberofPeople, double taxRate)
{
    //codes
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.