Question: Java Create a Question class that contains a question and answer variable. Both are String values. Create an askQuestion method that will return a String

Java

Create a Question class that contains a question and answer variable. Both are String values. Create an askQuestion method that will return a String that contains the question. Create a check method that will return true if the given String parameter is equal to the correct answer.

Create a clone method that will be used to create copies of a question and avoid potential issues with shared variables. Create a Quiz class that contains an array of questions. Create an addQuestion method that will add questions to the quiz. Make sure you use the clone method when adding questions. Create a Driver class that creates 3 questions and adds them to a quiz. Display the first question then ask the user to input their answer. Use the check method to evaluate the users answer and inform them whether their answer is correct or incorrect.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!