--- Given a parent class below (Student), derive a child class (UndergradStudent).
The UndergradStudent should have two new members: float engScore, float bioScore.
The UndergradStudent should overwrite getGPA() to take into consideration of two new members.
--- In the main function, create one object of Student and another object of UndergradStudent and
let the two objects to call their own getGPA().
Student (int = 0, float = 0.0f, float = 0.0f);
Student::Student (int id, float ms, float cs)
ID = id;
mathScore = ms;
chemScore = cs;
void Student::getGPA ()
float gpa = (mathScore + chemScore)/2.0;
cout << "ID = " << ID << " PGA = " << gpa << endl;
Write a main function that does the followings:
--- Create an empty vector of Student class (see code above).
--- Add 4 Student objects to the vector using the push_back() method.
--- Use a loop to show GPAs of 4 objects.
--- Insert a new Student object in the middle of the vector.
--- Use a loop to show GPAs of 5 objects.
1.derive a child class.... 2. Write a main function...?? HELP! :'(
Post a Reply
|Oldest Newest Rating|
· April 25, 2015
Nobody will code this project for you. My advice is to watch the videos in C++ covering inheritance and vectors. Then if you still don't understand something, then post.
First set up the child class and introduce the new variables.
Then figure out how to get the GPA, which will just be similar to what Student has right now.
The main function is straightforward.
Used in many types of software including music players, video games, and many large scale applications.
|Bucky Roberts Administrator|