I never had c++, but i am in a program debbuing class that uses C++. I am not good with inheritance and class etc. I am having trouble debuing the following can someone please help..Thanks
// 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 = lasName;
lastName = lastName;
salary = 800;
}
void Employee::setData()
{
cout<<"Enter Employee's first name ";
cin>>frstName;
cout<<"Enter last name ";\
cin>lastName;
salary = 800;
void Employee::showEmployee()
{
cout<<firstName<<" "<<lastName<<
" Salary $"<<salary<<endl;
}
string Employee::getlastName()
{
return lstName;
}
string Employee::getfirstName()
{
return first
}
class : PartTimeEmployee : public : Employee
{
public:
PartTimeEmployee(string, string);
};
PartTimeEmployee::PartTimeEmployee(string first, string last) :
Employee(first,lst)
{
salary = 7.85;
}
int main()
{
const int NUMEMPS = 10;
Employee workers[NUMEMPS];
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[y] = temp;
}
cout<<endl<<"Employees: "<<endl;
for(x = 0; x <= NUMEMPS; ++x)
workers[NUMEMPS].showEmployee();
}