Home / Expert Answers / Computer Science / write-a-c-program-that-utilizes-virtual-methods-to-store-data-about-students-and-professors-creat-pa276

(Solved): Write a C++ program that utilizes virtual methods to store data about students and professors. Creat ...



Write a C++ program that utilizes virtual methods to store data about students and
professors. Create a base ‘person’ class, add two derived classes, student and professor. These
derived classes each contain a function called isOutstanding(). This function makes it easy for
the school administrators to create a list of outstanding students and professors for the venerable
Awards Day ceremony.
Input the person's name (student or professor)
For a student: if GPA > 3.5, the student is outstanding
For a professor: if a professor has more than 20 publications, the professor is outstanding

 

Note: The functions to get the data (getData()) and to check if a person is outstanding or not
(isOutstanding()) will be virtual in base class and will have different definitions in student and
professor classes. The names of the functions, however, will be the same (and hence the use of
virtual method)

 

Enter student or professor \( (s / p): s \)
Enter name: Timmy
Enter students GPA: \( 1.2 \)
Enter another \( (y / n) ? y \)

Enter student or professor \( (s / p): s \) Enter name: Timmy Enter student's GPA: \( 1.2 \) Enter another \( (y / n) ? y \) Enter student or professor \( (s / p): s \) Enter name: Brenda Enter student's GPA: \( 3.9 \) Enter another \( (\mathrm{y} / \mathrm{n}) \) ? \( \mathrm{y} \) Enter student or professor (s/p): s Enter name: Sandy Enter student's GPA: \( 2.4 \) Enter another \( (\mathrm{y} / \mathrm{n}) \) ? \( \mathrm{y} \) Enter student or professor (s/p): p Enter name: Shipley Enter number of professor's publications: 714 Enter another \( (\mathrm{y} / \mathrm{n}) \) ? \( \mathrm{y} \) Enter student or professor (s/p): p Enter name: Wainright Enter number of professor's publications: 13 Enter another (y/n)? \( \mathrm{n} \) If the above inputs are given, the output should look as follows: Name is: Timmy Name is: Brenda This person is outstanding Name is: Sandy Name is: Shipley This person is outstanding Name is: Wainright


We have an Answer from Expert

View Expert Answer

Expert Answer


#include #include using namespace std; class Person { public: Person(string name) { this->name = name; } virtual void getData() {
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe