Ask Question
19 June, 10:37

In c++

Consider the following definition of the class studentType:

public studentType: public personType

{

public:

void print ();

void calculateGPA ();

void setID (long id);

void setCourses (const string c[], int noOfC);

void setGrades (const char cG[], int noOfC);

void getID ();

void getCourses (string c[], int noOfC);

void getGrades (char cG[], int noOfC);

void studentType (string fName = "", string lastName = "",

long id, string c[] = NULL, char cG[] = NULL, int noOfC = 0);

private:

long studentId;

string courses[6];

char coursesGrade[6]

int noOfCourses;

)

Rewrite the definition of the class studentType so that the functions print and calculateGPA are pure virtual functions.

+5
Answers (1)
  1. 19 June, 10:54
    0
    class studentType: public personType

    {

    public:

    virtual void print () = 0;

    virtual void calculateGPA () = 0;

    void setID (long id) {

    studentId = id;

    }

    void setCourses (const string c[], int noOfC) {

    noOfCourses = noOfC;

    for (int i=0; i
    courses[i] = c[i];

    }

    }

    void setGrades (const char cG[], int noOfC) {

    noOfCourses = noOfC;

    for (int i=0; i
    coursesGrade[i] = cG[i];

    }

    }

    long getID () {

    return studentId;

    }

    string * getCourses () {

    return courses;

    }

    char * getGrades () {

    return coursesGrade;

    }

    studentType (string fName = "", string lastName = "",

    long id = 0, string c[] = NULL, char cG[] = NULL, int noOfC = 0);

    private:

    long studentId;

    string courses[6];

    char coursesGrade[6];

    int noOfCourses;

    };

    Explanation:

    Code rewritten
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “In c++ Consider the following definition of the class studentType: public studentType: public personType { public: void print (); void ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers