Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribedI need to write this code in C++, it should have two separate files: NAquestion.h and NAquestion.cpp

image text in transcribed

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 three

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

Prelude to Programming (6th Edition) Chapter 4, Problem 5PC...

Answered: 1 week ago

Question

Why is it important to match sources and methods of recruitment?

Answered: 1 week ago