Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

language is c++ ****below is the test program to test the class****** #include #include #include #include #include #include // uncomment the following lines to test

image text in transcribed

language is c++ ****below is the test program to test the class****** #include  #include  #include  #include  #include  #include  // uncomment the following lines to test your project #define testInstruct #define testStudent #define testJob #include "Instructor.hpp" #include "Student.hpp" using std::string, std::cout, std::endl, std::setw; void makePersonInfo(string &name, string & address); string makeHours(); float makeGPA(); int main() { unsigned int seed = static_cast(time(nullptr)); srand(seed); string name, address; const int NAMELEN = 15, ADDLEN = 15; #ifdef testInstruct cout getName(); address = theInstructors[i]->getAddress(); officeHrs = theInstructors[i]->getOfficeHours(); cout getName(); address = theStudents[i]->getAddress(); gpa = theStudents[i]->getGPA(); cout getName() getAddress() getJob() (rand()%100)/100.0; }
3) Instructor Student Problem (Polymorphism) Define a Person class with the following class variables string name and address. For methods it should have a default constructor that sets both variables to the empty string. It should have an overloaded constructor that takes parameters for all variables. Each variable should have a setter and a getter. There should be a method getjob that is hard coded to return the string "undefined". Define a class Instructor that is a Person. It should add the variable Office hours (a string) with setter and getter. It has a method getJob that is hard coded to return the string "instructor". Define a class Student that is a Person. It should add the variable GPA which is a float along with setter and getter. It has a method getJob that is hard coded to return the string "student". Use the test program in main to test your 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

More Books

Students also viewed these Databases questions