Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The main purpose of this lab is to practice inheritance and polymorphism using multiple classes. Activity You are required to write a C++ program that

image text in transcribedimage text in transcribed

The main purpose of this lab is to practice inheritance and polymorphism using multiple classes. Activity You are required to write a C++ program that implements the concepts of inheritance and polymorphism. For this purpose, in this lab, you are required to create 3 classes with the following details: - A Student class (Parent class): - A protected levels - A default Constructor - to add the student study level in the vector - vector\& getStudyLeve1s() to get the protected vector levels - A class (Child class of Student class): - A default Constructor - A class (Child class of Student class): - A default Constructor Once you have all 3 classes in place, create a global function ( which would ask the user to enter the study level for 10 students, e.g., graduate or undergraduate. On each entry of the study level by the user, the program should check whether the study level entered by the user is graduate or undergraduate. If it is undergraduate, create an object of the Undergraduate class and make a parent class pointer point to this child object, then add that pointer to vector & v which is passed as a parameter to this function. Do the same for graduate as well. At each entry of the user besides putting the parent pointer into a vector, also, call function using the parent pointer from the and add the level value to this vector. Remember you have 2 vectors, e.g., a vector that holds the pointers of Student class and a vector that is part of the student class called levels. Handle both the vectors with care not to confuse yourself. Once all the appropriate elements are put into their respective vectors, iterate through the levels vector using using the Student class pointer stored in the and count the number of graduate and undergraduate students. You are most welcome to create any more methods if required. Please note the following: - If you are creating separate header files for classes, make sure to submit both header and Source.cpp files on Canvas. - You can only use \#inc1ude, and libraries. - Your main method should look something like this: Please note the following: - If you are creating separate header files for classes, make sure to submit both header and Source.cpp files on Canvas. - You can only use , and libraries. - Your main method should look something like this: return 3 Below is the screenshot of the expected output of this program: Enter a study level: undergraduate Enter a study level: graduate Enter a study level: graduate Enter a study level: graduate Enter a study level: undergraduate Enter a study level: undergraduate Enter a study level: undergraduate Enter a study level: undergraduate Enter a study level: graduate Enter a study level: graduate Undergraduates: 5 Graduates: 5 Submission You should submit all source files containing your work from the activity through the drop box here. Do not submit ZIP, RAR, or other packages; submit the .cpp and .h files needed to run your code individually

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_2

Step: 3

blur-text-image_3

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

Question

What is the state with the highest percentage of rejected loans?

Answered: 1 week ago

Question

How much was spent by the biggest business unit?

Answered: 1 week ago

Question

Which user, represented by an actual name, spent the most?

Answered: 1 week ago

Question

What do you think the ePay Cardholder account is used for?

Answered: 1 week ago