Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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. (we are not creating an object of type person for this test).

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).

Once you are done, you are to 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 bubbleish sort used in the review for test. look up the exact way to code Bubblesort in the book.

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

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

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions