write a method that loops through each question and its 4 possible answers. Using the…
- User
write a method that loops through each question and its 4 possible answers. Using the scanner class, ignore case and if the answer is correct, increment score by 1 Here are the questions with potential answers: public class Runner { // create a quiz // use a loop to iterate through the questions // use a loop to make sure they only entered the appropriate response // give them their score at the end // give them a fun comment about their score. public static void main (String [] args) { int score = 0;
Scanner sc = new Scanner (System.in); // all of questions will be stored in this list: String [] questions = { "Where did pumpkin carving originate?", "In what century was halloween first introduced?", "Who brought Halloween to the United States?", "When will the next full moon be on halloween?", "Which state produces the most amount of pumpkins?", "Who wrote the horror book frankenstein?", "What colors make up Freddy Krueger’s shirt in A nightmare on elms street?", "What is the least favorite Halloween candy?", "How many pounds of candy corn are produced every year?", "How many pounds of chocolate are sold during halloween week?" }; String[] answers = { "Germany (a)\n" , "Scotland (b)\n", "Ireland (c)\n", "Greece (d)\n", "17th century (a)\n", "18th century (b)\n", "15th century (c)\n", "19th century (d)\n", "Germans (a)\n", "Scottish (b)\n", "Finnish (c)\n", "Irish (d)\n", "2039 (a)\n", "2041 (b)\n","2050 (c)\n", "2039 (d)\n", "Colorado (a)\n", "Nevada (b)\n", "Illinois (c)\n", "Minnesota (d)\n", "John Booth (a)\n", "Mary Shelly (b)\n", "John Booth (c)\n", "John Booth (d)\n", "Red and green (a)\n", "Blue and yellow (b)\n", "Black and white (c)\n", "Purple and orange (d)\n", "Twizzlers (a)\n", "Snickers (b)\n", "Candy corn (c)\n", "Skittles (d)\n", "50 million pounds (a)\n", "35 million pounds (b)\n", "20 million pounds (c)\n", "10 million pounds (d)\n", "90 million pounds (a)\n", "60 million pounds (b)\n", "80 million pounds (c)\n", "100 million pounds (d)\n" }; Here are the correct answers:Where did pumpkin carving originate? Ireland
In what century was halloween first introduced? 19th century
Who brought Halloween to the United States? The irish
When will the next full moon be on halloween? 2039
Which state produces the most amount of pumpkins? Illinois
Who wrote the horror book Frankenstein? Mary shelley
What colors make up Freddy Krueger’s shirt in A nightmare on elms street? Red and green
What is the least favorite Halloween candy? Candy corn
How many pounds of candy corn are produced every year? 35 million pounds
How many pounds of chocolate are sold during halloween week? 90 million pounds
- Assistant
Here is the method that loops through each question and its 4 possible answers, and increments the score if the answer is correct:
- User
it needs to show all the choices too
- Assistant