Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need to write this code in C++, it should have two separate files: NAquestion.h and NAquestion.cpp Question class Create a class for a question.
I need to write this code in C++, it should have two separate files: NAquestion.h and NAquestion.cpp
Question class Create a class for a question. Question -text: string +setText(string): void +getText() const: string +display() const: void +Question() +Question(string) Function/constructor description: setText, text's mutator. getText, text's accessor. display, shows the question's text. Question, initializes text as an empty string. Question(string), initialize text with the constructor argument. Numeric-Answer question class Create a derived class for a numeric-answer question from the question base class. Use public as the access specifier for the inheritance. NAquestion -correctAnswer Min: float -correct Answer Max: float tsetCorrect Answer(float.float): void +getCorrectAnswer Min() const: float +getCorrectAnswer Maxl) const: float +isCorrect(float) const: bool +NAquestion() +NAquestion(string.float.float) As seen in the diagram, NA question has two private member variables: correctAnswer Min, and correct Answer Max. correctAnswer Min and correctAnswerMax define the range of values accepted as a correct answer. Thus, correct Answer Min is less than or equal to correctAnswer Max. Also, it has one mutator: setCorrect Answer and two accessors: getCorrect Answer Min, and getCorrectAnswer Max. In setCorrect Answer function, the first argument is the value for correctAnswer Min, and the second argument is the value for correctAnswer Max. Therefore, if the first argument's value is not less than or equal to second argument's value, do not change the values of correct Answer Min and correct AnswerMax. In addition, this class has a function called isCorrect, which given a float argument, it will return whether that float argument is between correctAnswer Min and correctAnswerMax (true or false). Finally, it has 2 constructors: a no-argument constructor, and a three-argument constructor. The threeStep 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