Question: In C++, You will be applying your knowledge about inheritance and polymorphism to create a family of college instructors classes. Be sure to follow this

In C++,

You will be applying your knowledge about inheritance and polymorphism to create a family of college instructors classes. Be sure to follow this specification exactly, because the testing code depends upon this contract.

Create a base class called Instructor. It contains a string data member called name. It contains a constructor that takes one string parameter (in order to set the name). It also contains two member functions salary() and instructorDetails(). Since an Instructor is too abstract in our scenario, make salary() a pure virtual function. The instructorDetails() should return a string in the following format:

Name: Simon Ayzman. Salary: $3000.

A toString() convenience function has been provided to you to convert double's to string's.

Create a subclass called Adjunct that inherits from Instructor. An Adjunct has a salary of $3,000.00. Everything else remains the same.

Create another subclass called Professor that inherits from Instructor. A Professor has a bool data member called isTenured. Besides one parameter for the name, the Professor constructor should accept an additional parameter to set the isTenured value. If a Professor is tenured, the salary is $80,000.00. If not, it is $50,000.00. Moreover, modify the instructorDetails() function to output the parent class information, plus whether the professor is tenured or not. For example:

Name: William Sakas. Salary: $80000. (Tenured)

Name: James Joyce. Salary: $50000. (Not Tenured)

I have personally created a class called Faculty that is meant to test your Instructor family of classes. Please do not modify it.

If you have any questions or need for clarification, feel free to ask. Note that the code has been left intentionally sparse.

#include #include #include

using namespace std;

template string toString(T type) { std::ostringstream strs; strs << type; return strs.str(); }

// Implement classes here

class Faculty { public: void addFacultyMember(Instructor* instructor) { facultyMembers.push_back(instructor); } string listFacultyMembers() { string list; for(unsigned int i = 0; i < facultyMembers.size(); ++i) { list += (facultyMembers[i]->instructorDetails() + ' '); } return list; } protected: vector facultyMembers; };

int main() { // Include testing code here }

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!