Using C# Create the “TestQuestion” class. It will have two class variables: 1) a question and 2)...

70.2K

Verified Solution

Question

Programming

Using C#

Create the “TestQuestion” class. It will have two classvariables: 1) a question and 2) the answer to that question. Pleasecreate an accessor and mutator method for both of those variables,without which we would not be able to see or change the question orthe answer.

There should be a constructor method. We will also have a“ToString” or “__str__” method, which will print the questionfollowed by its answer.

The constructor method has two parameters to allow the user toenter a test question and answer, or if no input/parameters aregiven then a default question and answer should be supplied.

The last method of the class, CheckAnswer, should take in astring as a parameter and compare it to the answer. If the inputwas incorrect, it should return false. Otherwise, it should returntrue and then the main should tell the user they were correct andhave them input a new test question and answer.

Answer & Explanation Solved by verified expert
3.7 Ratings (513 Votes)
TestQuestioncsusing Systemusing SystemCollectionsGenericusing SystemLinqusing SystemTextusing SystemThreadingTasksnamespace Simplequsestionclassclass TestQuestionprivate string question answerpublic TestQuestionstring ques string ansthisquestion    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students