subject

Use the Question class from Chapter 7 to define a Quiz class. A quiz can have up to 25 questions (create an array of 25 Question objects within your Quiz class). Define an add method of the Quiz class that adds a question to a quiz. Define a giveQuiz method of the Quiz class to present each question in order to the user, accept an answer, and keep track of the result (whether the answer is correct or incorrect). Define a driver class called QuizTime with a main method that creates a sample quiz with 3 questions (that you create and specify in your program), then presents the quiz to the user and prints the final results. Note you do not need to use the Complexity interface used by the Question class in Chapter 7 for this assignment. An example session in the Console window is given below. Example session
What color was George Washington's white horse?
blue
What's your favorite programming language?
Java
How many moons does the planet Earth have (specify a number)?
1
Correct: 2 Incorrect: 1
// // Question. java Author: Lewis/Loftus // // Represents a question (and its answer). //
public class Question implements Complexity { private String question, answer; private int complexityLevel; // // Constructor: 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; } }

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:00
How can i clip a picture to a question on the computer?
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Anetwork security application that prevents access between a private and trusted network and other untrusted networks
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Intellectual property rights are exclusive rights that protect both the created and the creation. ipr offers exclusively what benefits to the person or people covered by it
Answers: 3
You know the right answer?
Use the Question class from Chapter 7 to define a Quiz class. A quiz can have up to 25 questions (cr...
Questions
question
Biology, 21.06.2019 19:00
question
Biology, 21.06.2019 19:00
Questions on the website: 13722363