Computers and Technology
Computers and Technology, 25.09.2020 01:01, Acemirisa

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();
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 09:00, 19elbatawisaly
What is one way in which tablets differ from laptops and notebooks? tablets are designed for touch-based interaction. tablets are designed to be used as desktops. tablets are designed for input via a keyboard and mouse. tablets are designed to be larger than laptops.
Answers: 1
image
Computers and Technology, 22.06.2019 09:30, relic7391
Is a string of code written to hurt others by damaging or destroying
Answers: 1
image
Computers and Technology, 22.06.2019 11:30, mmimay3501
What do character formats do for your document's message? a. set the tone b. provide organization c. provide clarity d. set how texts align with documents
Answers: 2
image
Computers and Technology, 24.06.2019 16:30, officialrogerfp3gf2s
Pressing the backspace key deletes the text to the of the insertion point. the left or the right?
Answers: 1
Do you know the correct answer?
Quiz Use the Question class o define a Quiz class. A quiz can be composed of up to 25 questions. Def...

Questions in other subjects:

Konu
English, 05.02.2021 03:30