fix errors with classes and question about syntax for main

ok, im trying to figure out here how to call two classes in main, and i need help correcting the errors. the point here in main is to get it to call the employee section, and then have it call the payroll function for each of the three employees. ill post the code with the headers first then errors.

[code]
/* christopher bruce

payroll class header file
*/

#include <string>
using namespace std;


class payroll
{
int hours;
double hourlyrate;
double grosspay;
int maxhours;
public:
payroll ();
payroll (int, double, double, int);

};
/*
christopher bruce
employee class header file
*/
#include <string>
using namespace std;

class employee
{
string firstname;
string lastname;
const char* idnum;
string dept;
string position;

public:
employee();
employee(string, string, const char*, string, string);

};
#include <iostream>
#include <cmath>
#include <string>
#include <fstream>
#include "employee.h";
#include "payroll.h";

using namespace std;

int hours;
double hourlyrate;
double grosspay;
int maxhours;


employee::employee ()
{
employee employee1;
employee employee2;
employee employee3;

employee1.firstname = "susan";
employee1.lastname = "meyers";
employee1.idnum = "47899";
employee1.dept = "accounting";
employee1.position = "vice president";

employee2.firstname = "mark";
employee2.lastname = "jones";
employee2.idnum = "39119";
employee2.dept = "it";
employee2.position = "programer";

employee3.firstname = "joy";
employee3.lastname = "rogers";
employee3.idnum = "81774";
employee3.dept = "manufacturing";
employee3.position = "engineer";
cout << employee1.firstname << " " << employee1.lastname << " id number: " << employee1.idnum << " " << employee1.dept << " " << employee1.position << endl;
cout << employee2.firstname << " " << employee2.lastname << " id number: " << employee2.idnum << " " << employee2.dept << " " << employee2.position << endl;
cout << employee3.firstname << " " << employee3.lastname << " id number: " << employee3.idnum << " " << employee3.dept << " " << employee3.position << endl;
payroll employee1;
payroll employee2;
payroll employee3;
}


void payroll ()
{
cout << "please enter the payrate:";
cin >> hourlyrate;
cout << "please enter the hours:";
cin >> hours;
if (hours > 60)
{
hours = 0;
cout << "hours must be less then 60. ";
cout << "please reenter hours:";
cin >> hours;
}
else
{
grosspay = hourlyrate * hours;
}
cout << "the gross pay for the week is " << grosspay << endl;
}

int main ()
{

cout << "here are three random employees from a random company" << endl;

cout <<"now lets calculate last weeks paycheck for them:" << endl;



}
Error 5 error C2065: 'employee1' : undeclared identifier c:\documents and settings\allisa\my documents\visual studio 2010\projects\classes\classes\class.cpp 71 1 classes
this one times three
Error 3 error C2146: syntax error : missing ';' before identifier 'employee1' c:\documents and settings\allisa\my documents\visual studio 2010\projects\classes\classes\class.cpp 71 1 classes
again three of these
12 IntelliSense: expected a ';' c:\documents and settings\allisa\my documents\visual studio 2010\projects\classes\classes\class.cpp 42 10 classes

13 IntelliSense: expected a ';' c:\documents and settings\allisa\my documents\visual studio 2010\projects\classes\classes\class.cpp 43 10 classes
14 IntelliSense: expected a ';' c:\documents and settings\allisa\my documents\visual studio 2010\projects\classes\classes\class.cpp 44 10 classes

Topic archived. No new replies allowed.