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 11:20
The kurt vonnegut commencement speech, the neiman-marcus chocolate chip cookie recipe, and the get-well emails to the dying boy are examples of select one: a. social engineering b. hoax emails c. email viruses d. worms
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
You are new to microsoft certification and want to start out by getting a certification geared around windows 8. what microsoft certification should you pursue?
Answers: 1
question
Computers and Technology, 24.06.2019 08:50
Write a program that will compute the volume of ice cream served in a cone. as you can see in the diagram below, the ice cream is served as a hemisphere of frozen deliciousness on top of a cone, which is also packed with frozen deliciousness. thus, the total volume of ice cream sold is the volume of the hemisphere plus the volume of the cone. the example shows an ice cream cone in which the hemisphere and cone have a radius of 10 inches and the cone has a height of 15 inches. your program must instead prompt for these two values, which are taken from the keyboard as integers: • the hemisphere/cone radius in inches, and
Answers: 3
question
Computers and Technology, 24.06.2019 18:20
The following if statement contains a logic error, not a syntax error. rewrite it so that it is correct. assume the variable age already exists and holds a valid number. if (age == 18 & & age == 19) {
Answers: 1
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
Questions on the website: 13722360