Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You ll be creating two classes. A Question Class and a Quiz Class. Question class Each object created from the Question Class will hold one
Youll be creating two classes. A Question Class and a Quiz Class.
Question class
Each object created from the Question Class will hold one question. Objects created from the
Question class should have the following attributes:
The question text string
The question answer string
Level of difficulty integer being easy, being difficult
All attributes should be private, and there should be getterssetters for all attributes. It should
have a constructor that sets all attributes.
Quiz class
The Quiz class must contain an arraylist or list of objects that should be created from the
Question Class. The Quiz class should have the following methods:
addquestion Method should prompt the user for a new question, answer and difficulty,
and then create a Question object with that data and add it to the arraylistlist
removequestion Method should present the user with a list of all the question texts,
and ask which one to remove. When the user indicates the question to remove, it should
remove that question from the arraylistlist
modifyquestion Method should present the user with a list of all the question texts, and
ask which one to change. Then it should prompt the user for the new question text, the
new question answer, and the new difficulty, and update the appropriate question in the
arraylist.
givequiz Method should present each question to the user, accept an answer string
for each question. It should then tell the user if they are correct or wrong if the string the
user typed in exactly matches the correct answer stored in the question object they are
correct Keep track of their score. At the end of the quiz, tell the user how many they
got correct.
Driver:
Your driver program should create an instance of Quiz, then present the user with a menu.
Add a question to the quiz
Remove a question from the quiz
Modify a question in the quiz
Take the quiz
Quit
Keep presenting the same menu over and over until the user quits.
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