class math : public student
math (string n1,string n2, string s, int q1, int q2, int q3, int q4, int q5, int t1, int t2, int f):
quiz1(q1),quiz2(q2), quiz3(q3), quiz4(q4), quiz5(q5),student(n1,n2,s)
Re: input from a file and storing in array of objects
From the assignment description, it is quite clear that the instructor is referring to arrays containing base class pointers.
To know which Student object to create (i.e. History, English, etc), you need to read the subject string and decide. You can pass the parameters needed for that Student Object to calculate average in its Constructor something like:
EnglishStudent( int firstSemGrade, int homeworkGrade ) etc
You need to allocate this object using new, of course and store its pointer in the Student array.
One you have this array ready, then comes calculating averages.
To calculate average, you can provide a virtual pure function in Student class like
virtual int CalcAvg() = 0; And you need to override it in the derived classes to implement the specific average calculating algorithm.