Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; class Student { private: unsigned long int id; string name; double gpa; public: void setVars(string name,long id,double gpa) { this->name=name;

image text in transcribed

#include #include using namespace std; class Student { private: unsigned long int id; string name; double gpa; public: void setVars(string name,long id,double gpa) { this->name=name; this->id= id; this->gpa=gpa; } public: void getVars() { cout

} }; int main() { Freshman obj(78); obj.setVars("venkanna",547L,9.8); obj.getVars(); Senior obj2(77); obj2.setVars("koothada",548L,9.7); obj2.getVars(); return 0; }

Change test score variables in the derived classes definition to a dynamic array that will now contain the scores of all tests taken by the student. Add private integer variable, number of scores, to store how many tests a student has taken and another private double variable to calculate average score. You can remove the parameterized constructors for this problem. Modify the mutator function in both derived classes as follows: Accessor must now prompt the user for the value of number of scores and assign dynamic memory. In this function, also calculate the average of the scores. Only in the mutator function of the derived class Freshman, add 5 to the average score after calculating the average. We are giving Freshmen 5 bonus points, no points for Seniors. Modify Accessor function to display name, id, gpa and average score. In destructor function in derived class, clear the dynamic memory In main function: Create an object each of both derived classes with parameters. Call mutator functions to set values and the accessor functions to get the values of the variables

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions