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 16:00
If a client wants to make minor edits, what should he/she use?
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
For her science class, elaine is creating a presentation on weather in the united states. she wants to make the presentation beautiful and interesting by drawing simple cloud or wave shapes. which is the best way for elaine to draw these shapes?
Answers: 1
question
Computers and Technology, 23.06.2019 00:40
Consider the following statements: struct nametype{string first; string last; }; struct coursetype{string name; int callnum; int credits; char grade; }; struct studenttype{nametype name; double gpa; coursetype course; }; studenttype student; studenttype classlist[100]; coursetype course; nametype name; mark the following statements as valid or invalid. if a statement is invalid, explain why.a.) student.course.callnum = "csc230"; b.) cin > > student.name; c.) classlist[0] = name; d.) classlist[1].gpa = 3.45; e.) name = classlist[15].name; f.) student.name = name; g.) cout < < classlist[10] < < endl; h.) for (int j = 0; j < 100; j++)classlist[j].name = name; i.) classlist.course.credits = 3; j.) course = studenttype.course;
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
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, 26.05.2021 01:00
question
Mathematics, 26.05.2021 01:00