Question: Please do the following in VISUAL STUDIO code: Derive three classes from the provided Question class in the images below: Create a TrueFalseQuestion class as
Please do the following in VISUAL STUDIO code:
Derive three classes from the provided Question class in the images below:
Create a TrueFalseQuestion class as a child of the Question class. The class will contain one private bool data member for whether the answer to the question is true or false. You will include a constructor with default arguments for the question and answer, accessor and mutator functions for the private data member, and a destructor and Print function. Read the comments in the supplied truefalsequestion.h header file for more detailed requirements. Initial tests for the functionality of the TrueFalseQuestion class have been provided in the attached testtf.cpp source file. You are encouraged to create more rigorous tests.
Create a ShortAnswerQuestion class as a child of the Question class. The class will contain one private string data member for the correct answer to the question. You will include a constructor with default arguments for the question and answer, accessor and mutator functions for the private data member, and a destructor and Print function. Read the comments in the supplied shortanswerquestion.h header file for more detailed requirements. Initial tests for the functionality of the ShortAnswerQuestion class have been provided in the attached testsa.cpp source file. You are encouraged to create more rigorous tests.
Create a MultipleChoiceQuestion class as a child of the Question class. The class will contain three private data member: an int for the number of answer choices, a pointer to a string to hold the dynamically allocated array of answer choices, and a pointer to a bool to hold the dynamically allocated array of truefalse false values denoting whether or not each of the corresponding answer choices is correct. You will include a constructor with default arguments for the data members, a copy constructor, accessor and mutator functions described in the header file, and a destructor and Print function. Read the comments in the supplied multiplechoicequestion.h header file for more detailed requirements. Initial tests for the functionality of the MultipleChoiceQuestion class have been provided in the attached testmccpp and testmccpp source files.
Specifications Do not modify any of the code in question.h Add all code for the definition of the TrueFalseQuestion class to the attachedtruefalsequestion.h header file. Include all of the necessary code for the TrueFalseQuestion class, including the implementation of all of the public member functions, in the attached truefalsequestion.cpp source file. Add all code for the definition of the ShortAnswerQuestion class to the attached shortanswerquestion.h header file.
Include all of the necessary code for the ShortAnswerQuestion class, including the implementation of all of the public member functions, in the attached shortanswerquestion.cpp source file. Add all code for the definition of the MultipleChoiceQuestion class to the attached multiplechoicequestion.h header file. Include all the necessary code for the MultipleChoiceQuestion class, including the implementation of all of the public member functions, in the attached multiplechoicequestion.cpp source file. You are required to use pointers as data members in the MultipleChoiceQuestion class and to manage the dynamic allocation and deallocation of memory for these data members.
TESTING:
To test your TrueFalseQuestion class, type: make testtf
To test your ShortAnswerQuestion class, type: make testsa
To test your MultipleChoiceQuestion constructor with default arguments and Print function, type: make testmc
To Test your MultipleChoiceQuestion copy constructor and SetAnswerChoices function, type: make testmc
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
