The key to solving this problem is learning how to read and understand code, an important skill for a computer scientist. The problem follows the patterns illustrated in the Actor 3 example. Please notice that the problem establishes the variable names, both members and parameters, and you must use them consistently in your solution.
class Person
{
private:
string name;
public:
Person(string n) : name(n) {}
void display() { cout << name << endl; }
};
class Project
{
private:
char code;
public:
Project(char c) : code(c) {}
void display() { cout << code << endl; }
};
class Record
{
private:
double salary;
public:
Record(double s) : salary(s) {}
void display() { cout << salary << endl; }
}
class Employee : public Person // Inheritance
{
private:
Record myRecord; // Composition
Project* myProject = nullptr; // Aggregation
int id;
public:
Employee(string name, double s, int i)
: (a)_______________________________________{}
~Employee(){ if (myProject != nullptr) (b)____________; }
void set_project(char a_code)
{
(c)_________________________________________________;
}
void display() {(d)_______________________________}
};
Fill in the blanks to complete the Employee class.