#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