Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q7. Write a class StudentRegister which contains a list of students, where students are objects of the classes you wrote in questions 3, 4 and
Q7. Write a class StudentRegister which contains a list of students, where students are objects of the classes you wrote in questions 3, 4 and 5. The class should have an array of pointer to Student to store student objects. It should be possible to store up to 1000 students in the register. The class should have a data member that records the number of students currently in the register. The class should have the following data members A constructor that takes no parameters and initializes the number of students to 0 . A method add(const Student & student) that allows a student object to be added to the register (to the array of pointers). This method should make a copy of the student passed to the method, using the new operator A destructor which frees all memory that has been allocated using new A void printintoForlD(int id) method that prints out information for the student with the given id value Your class should be generic, that is, it should only refer to Student objects and not to the derived classes ResearchStudent and TaughtStudent. To achieve this objective you may need to add a method to the classes of questions 3, 4 and 5. If you do this, state what code you have added and why Your class must operate correctly when called using the following code in main: TaughtStudent s1(10801, "i11", "Murray") s1.registerFor("EE280"); s1.registerFor("EE281); ResearchStudent s2(20001, "Clever, cloggs""Prof. Knowalot", "Hard Sums"); StudentRegister studentRegister studentRegister.add (s1); studentRegister.add(s2); int studentID-20081; cout
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started