I have been working on this code and I can't get it to work any help out there? I am a new user and would really appreciate it if somebody can correct whats going wrong with it.
// DEBUG10-4
// PartTimeEmployee derives from Employee
// Employees make $800 per week
// PartTimeEmployees make $7.85 per hour
#include<iostream>
#include<string>
using namespace std;
class Employee
{
protected:
string firstName;
string lastName;
double salary;
public:
Employee(string, string);
void showEmployee();
void setData();
string getfirstName();
string getlastName();
};
Employee::Employee(string first, string last)
{
firstName = firstName;
lastName = lastName;
salary = 800;
};
void Employee::setData()
{
cout<<"Enter Employee's first name ";
cin>>firstName;
cout<<"Enter last name ";
cin>>lastName;
salary = 800;
}
void Employee::showEmployee()
{
cout<<firstName<<" "<<lastName<<
" Salary $"<<salary<<endl;
}
string Employee::getlastName()
{
return lastName;
}
string Employee::getfirstName()
{
return firstName;
}
class PartTimeEmployee : public Employee
{
public:
PartTimeEmployee(string, string);
};
PartTimeEmployee::PartTimeEmployee(string first, string last) :
Employee(first,last)
{
salary = 7.85;
}
int main()
{
const int NUMEMPS = 3;
string first;
string last;
Employee workers(first, last);
int x;
for(x = 0; x < NUMEMPS; ++x)
{
Employee temp;
char pt;
temp.setData();
cout<<"Is employee part time - y or n? ";
cin>>pt;
if(pt = 'y')
{
PartTimeEmployee tempPartTime(temp.getfirstName(), temp.getlastName());
temp = tempPartTime;
}
workers[NUMEPS] = temp;
}
cout<<endl<<"Employees: "<<endl;
for(x = 0; x <= NUMEMPS; ++x)
workers[NUMEMPS].showEmployee();
system("pause");
}
HELP PLEASEEE!!!!