Question: Step 4 : Define a Person struct with components firstName and lastName ( both of type string ) . Step 5 : Define a class

Step 4: Define a Person struct with components firstName and lastName (both of type string).
Step 5: Define a class called Employee with the following:
Private data members:
name (of type Person)
position (of type string)
baseSalary (of type int)
Public member functions:
set(): Takes parameters to set name, position, and baseSalary. Complete this function where marked "implement me".
getBaseSalary(): Returns the base salary.
print(): Outputs the employee details (name, position, and base salary).
A default parameterized constructor "implement me".
Step 6: Define a class called Manager that publicly inherits from the Employee class. This class has the following:
Private data members:
department (of type string)
bonusPercentage (of type int)
specialty (of type string)
salary (of type int)
Public member functions:
set(): Sets department, bonusPercentage, specialty and inherits set() from Employee. Complete the function where marked "implement me".
calculateSalary(): Calculates the final salary as the base salary plus the bonus percentage.
print(): Outputs details of the manager, including department and final salary "implement me".
A default parameterized constructor. "implement me".
Implement the member functions of both classes where marked "implement me".
The following driver produces the given output:
#include "manager.h"
int main()
{
Manager Omar;
Omar.set("Omar", "Ali", "Software Engineer", 15000, "Development", "Artificial Intelligence", 15);
Omar.print();
return 0;
}
Sample output:
Omar Ali has a Software Engineer degree and his/her salary is 15000
He/She is specialized in Artificial Intelligence and his/her total salary is 17250

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 Programming Questions!