Question: Consider the following partial class definitions for Employee ( base class ) and HourlyEmployee ( derived class ) : class Employee { public: string getName

Consider the following partial class definitions for Employee (base class) and HourlyEmployee (derived class):
class Employee {
public:
string getName();
string getSSN();
string getPay();
void setName(string);
void setSSN(string);
void setPay(double);
private:
string name;
string ssn;
double netPay;
};
class HourlyEmployee: public Employee {
public:
void print();
private:
double wageRate;
double hours;
};
void HourlyEmployee::print(){
netPay = wageRate * Hours;
cout << "Name: "<< name << endl;
cout <<"SSN: "<< ssn << endl;
cout << "Wagerate: "<< wageRate << endl;
cout << "Hours: "<< hours << endl;
cout << "Net Pay "<< netPay << endl;
}
Identify what is wrong with the print() function, and correct it by modifying the code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!