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
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