Can someone help me with this probem please. Thank you.

#include <iostream> 
#include <iomanip>

using namespace std;

int main()
{

double pay_rate, hours, regular_pay;
double overtime_pay, gross_pay, tax, net_pay;
// The functions receive no parameters and return no results.  
// All communication is through the global variables.

void Calculate_Gross_Pay();
void Calculate_Tax();
void Calculate_Net_Pay();
void Display_Results();

{
    cout << "Enter the person's pay rate: ";
    cin >> pay_rate;
    cout << "Enter the person's number of hours worked: ";
    cin >> hours;

    Calculate_Gross_Pay();
    Calculate_Tax();
    Calculate_Net_Pay();
    Display_Results();

    return 0;
}

void Calculate_Gross_Pay()
{

    if (hours > 40)
	{
	Gross_Pay = 40 * pay_rate;
	overtime_pay = (hours - 40) * 1.5 * pay_rate;
	}
	else
	{
	Gross_Pay = hours * pay_rate; overtime_pay = 0;
	Gross_pay = regular_pay + overtime_pay; 

	
	void Calculate_Tax()
	{
	if((employee_code == 'A') || (employee_code == 'a'))
	tax = gross_pay * RESIDENT_RATE;
	}
	else
	{
	tax = gross_pay * NON_RESIDENT_RATE;
	}
	else
	{
	tax = 0;
	void Calculate_Net_Pay();
    net_pay = gross_pay - tax;  
	void Display_Results();
	{

    cout << endl << endl;
	cout << "Regualar Pay: " << setw(7) << regular_pay << endl; cout << "Overtime Pay: " << setw(7) << overtime_pay << endl;
	cout << "Tax; " << setw(7) << tax << endl;
	cout << "Gross Pay: " << setw(7) << gross_pay << endl;
	cout << "---------------------" << endl;
	cout << "Net Pay: " << setw(7) << net_pay << endl; 

return 0;

}

Error message

Compiling...
Lab7B.cpp
C:\DOCUMENTS AND SETTINGS\ANDREA MC FARLANE\DESKTOP\STRAYER ONLINE WORK ONLY\Lab7B\Lab7B.cpp(34) : error C2601: 'Calculate_Gross_Pay' : local function definitions are illegal

C:\DOCUMENTS AND SETTINGS\ANDREA MC FARLANE\DESKTOP\STRAYER ONLINE WORK ONLY\Lab7B\Lab7B.cpp(74) : fatal error C1075: end of file found before the left brace '{' at 'C:\DOCUMENTS AND SETTINGS\ANDREA MC FARLANE\DESKTOP\STRAYER ONLINE WORK ONLY\Lab7
B\Lab7B.cpp(57)' was matched
Error executing cl.exe.

Lab7B.obj - 2 error(s), 0 warning(s)

There are many errors in your code.
To start with . All Function Declarations and Global Variables Should not be declared inside main.

The have to be declared outside any code block.

Secondly , You have different sets of variables. Like in one line you have used.

Gross_Pay=;

and in the declaration you have.

gross_pay;

C++ Considers both of them as different variables.

The third thing is that lots of end tags for your function definitions are missing .

You have also got a variable employee_code that has not been declared.

Function Definitions donot have to have a ';' at thier end

for example

void Display_Results();//This is wrong
{

cout << endl << endl;
cout << "Regualar Pay: " << setw(7) << regular_pay << endl; cout << "Overtime Pay: " << setw(7) << overtime_pay << endl;
cout << "Tax; " << setw(7) << tax << endl;
cout << "Gross Pay: " << setw(7) << gross_pay << endl;
cout << "---------------------" << endl;
cout << "Net Pay: " << setw(7) << net_pay << endl;

return 0;

}
void Display_Results()
{

cout << endl << endl;
cout << "Regualar Pay: " << setw(7) << regular_pay << endl; cout << "Overtime Pay: " << setw(7) << overtime_pay << endl;
cout << "Tax; " << setw(7) << tax << endl;
cout << "Gross Pay: " << setw(7) << gross_pay << endl;
cout << "---------------------" << endl;
cout << "Net Pay: " << setw(7) << net_pay << endl;

return 0;

}

This is right.

This article has been dead for over six months. Start a new discussion instead.