In Pakistan, universities have adopted the semester system for the purpose of education. In semester system, two types of formal exams (i.e. Mid Term Exam and Final Term Exam) are generally conducted in every semester. Each exam is composed of certain number of questions which can be of two types: multiple choice questions (MCQs) and descriptive questions.
Keeping in mind the above scenario, consider the following class diagram showing the composition relationship between Exam and Question classes.
Now, you are required to write a C++ program for above for above class diagram.
Carefully analyze the given class diagram and write code according to classes, attributes, functions and relationship mentioned in class diagram.
In Exam class, data member NoOfQuestions will have some fixed value. It is set to 2 to generate the sample output.
As one Exam is composed of many questions, so here you have to use the concept of array of objects. Size of array will be based on value of Number of questions. It is set to 2 to generate the sample output.
In Question class, all getter functions should be constant.