Question: (Visual Studio C++) There is a class called Person which has name and age as private variables. Another class called Student, which is derived from
(Visual Studio C++)
There is a class called Person which has name and age as private variables. Another class called Student, which is derived from person with gpa and ID as variables. Name is a string, age and ID are integers and gpa is a double... All of them are private variables.
Age, gpa and id should be generated randomly when the object is created with the following ranges:
age 20 to 32
gpa 0.0 to 4.0 // this one is tricky to get as random doesnt generate decimal numbers.
ID 1000 to 9999
In the start of the program, you will ask for how many students there are. Dynamically create an array of students of that size. (not creating an object of type person). In a loop, you will ask for the names of each of these people (all the other data was already created randomly through the constructors). Display everyone in the array neatly. Sort the students by gpa (from highest to lowest, make sure you sort the students not just swapping of gpa) (do not use the bubble sort) and display the sorted array neatly. (show the Students, not just the GPA's).
Step by Step Solution
There are 3 Steps involved in it
Heres a detailed guide on how to implement this task using C in Visual Studio Step 1 Include Necessary Headers Start by including necessary headers Yo... View full answer
Get step-by-step solutions from verified subject matter experts
