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 04:00
When you collaborate or meet with a person or group online, it is called
Answers: 1
question
Computers and Technology, 22.06.2019 05:00
This program will store roster and rating information for a soccer team. coaches rate players during tryouts to ensure a balanced team. (1) prompt the user to input five pairs of numbers: a player's jersey number (0 - 99) and the player's rating (1 - 9). store the jersey numbers in one int vector and the ratings in another int vector. output these vectors (i.e., output the roster). (3 pts) ex: enter player 1's jersey number: 84 enter player 1's rating: 7 enter player 2's jersey number: 23 enter player 2's rating: 4 enter player 3's jersey number: 4 enter player 3's rating: 5 enter player 4's jersey number: 30 enter player 4's rating: 2
Answers: 1
question
Computers and Technology, 22.06.2019 06:00
What role do chromosomes play in inheritance?
Answers: 1
question
Computers and Technology, 22.06.2019 10:50
Using least squares fitting, you are to fit the data sets to the following models and solve for the parameters ai , where i is the index of the parameter. the input/output data for the systems are linked in the bblearn site. for each of the systems use matlab to plot the supplied data vs. the model fit on one plot. include your code in the solutions. (a) linear fit "lineardata.mat" y=a1x^3 + a2x^2 + a3x + a4 (b) plant fit "plantdata.mat g(s) = a1/(s + a2)
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: 13722367