Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS 162 Assignment Four (Dynamic Polymorphism) Extend the Employee class to include setters and getters for EmployeeName and EmployeeID EmployeeGroup. etc...... Your output should look

CS 162 Assignment Four (Dynamic Polymorphism) Extend the Employee class to include setters and getters for EmployeeName and EmployeeID EmployeeGroup. etc...... image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Your output should look like the following: (In addition to the original output from the employee class we implemented in class).

First output line:

New Employee is in the Engineering Group

Second Output Line:

This Employee is the Chief Executive Officer of the Company and is a member of the Executive Suite based in New York.

Extend the Employee class to include setters and getters for EmployeeName and EmployeeID EmployeeGroup. In addition include a print function that will facilitate dynamic polymorphism. Your Employee class header file should look similar to what is shown below: class employee{ protected: int emp_id; string emp_name; string emp_group; public: employee(){}; employee(int, string); employee(int, string, string); void setEmployeeName(string); void setEmployeeID(int); void setEmployeeGroup(string); string getEmployeeName(); int getEmployeeID(); string getEmployeeGroup(); virtual void print(); }; Create a child class engineer whose parent is the employee class. The engineer class will have the following variables/constructors/methods(functions) in addition to the values inherited from its parent: string engineer_type; string engineer_location; public: engineer(){}; engineer(int, string, string, string, string); 1/setters and getters for engineer_type and engineer_location AND a print function // void print(); Create a engineer_impl file that will implement the functions defined in the engineer.h file Create a child class executive whose parent is the employee class. The executive class will have the following variables/constructors/methods(functions) in addition to the values inherited from its parent. Remember the executive class can only inherit from its parent (base) class. int exec_employment_duration; double executive_compensation; string executive_type; string executive_location; public: executive(){}; executive(int eid, string ename, string egroup, int eduration, double ecompensation, string etype, string elocation); void setExecutive EmploymentDuration(int); void setExecutiveCompensation(double); int getExecutiveEmploymentDuration(); double getExecutiveCompensation(); void print(); Create a executive_impl file that will implement the functions defined in the executive.h file Finally, update your emp_driver file to display run time polymorphism. Below is some example code that you would need to add: INOTE: You will need to add similar code related to the executive class employee *new_employee; engineer new_engineer(10651262, "Tim", "Software", "Computer Scientist", "Phoenix"); new_employee = &new_engineer; coutprint(); The above piece of code uses the engineer child class. Implement similar code working with the executive class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

How flying airoplane?

Answered: 1 week ago

Question

What were the reasons for your conversion or resistance?

Answered: 1 week ago