subject

Quiz Use the Question class o define a Quiz class. A quiz can be composed of up to 25 questions. Define the add method of the Quiz class to add a question to a quiz. Define the giveQuiz method of the Quiz class to present each question in turn to the user, accept an answer for each one, and keep track of the results. Define a class called QuizTime with a main method that populates a quiz, presents it, and prints the final results. public class Question implements Complexity
{
private String question, answer;
private int complexityLevel;
//
// Sets up the question with a default complexity.
//
public Question (String query, String result)
{
question = query;
answer = result;
complexityLevel = 1;
}
//
// Sets the complexity level for this question.
//
public void setComplexity (int level)
{
complexityLevel = level;
}
//
// Returns the complexity level for this question.
//
public int getComplexity()
{
return complexityLevel;
}
//
// Returns the question.
//
public String getQuestion()
{
return question;
}
//
// Returns the answer to this question.
//
public String getAnswer()
{
return answer;
}
//
// Returns true if the candidate answer matches the answer.
//
public boolean answerCorrect (String candidateAnswer)
{
return answer. equals(candidateAnswer);
}
//
// Returns this question (and its answer) as a string.
//
public String toString()
{
return question + "\n" + answer;
}
}
Modify your answer to PP 8.10 so that the complexity level of the questions given in the quiz is taken into account. Overload the giveQuiz method so that it accepts two integer parameters that specify the minimum and maximum complexity levels for the quiz questions and presents only questions in that com- plexity range. Modify the main method to demonstrate this feature.
public interface Complexity
{
public void setComplexity(int complexity);
public int getComplexity();
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:30
In the film "epic 2015," epic is the name for:
Answers: 3
question
Computers and Technology, 22.06.2019 20:00
How is the number 372 written when expanded out to place values in the base 8 (octal) number system? a. 2 x 4 + 3 x 2 + 4 x 1 b. 3 x 64 + 7 x 8 + 2 x 1 c. 3 x 8 + 7 x 7 + 2 x 6 d. 3 x 100 + 7 x 10 + 2 x 1
Answers: 1
question
Computers and Technology, 22.06.2019 22:50
Which is the best minecraft server? a. mineplex b. worldonecraft c. 9b9t d. 2b2t
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
You know the right answer?
Quiz Use the Question class o define a Quiz class. A quiz can be composed of up to 25 questions. Def...
Questions
question
Mathematics, 10.11.2020 09:20
question
Geography, 10.11.2020 09:20
question
Mathematics, 10.11.2020 09:20
question
Mathematics, 10.11.2020 09:20
question
History, 10.11.2020 09:20
Questions on the website: 13722363