Write an application that contains an array of 10 multiple-choice quiz questions related to your favorite hobby. Each question contains three answer choices. Also create an array that holds the correct answer to each question—A, B, or C. Display each question and verify that the user enters only A, B, or C as the answer—if not, keep prompting the user until a valid response is entered. If the user responds to a question correctly, display Correct!; otherwise, display The correct answer is and the letter of the correct answer. After the user answers all the questions, display the number of correct and incorrect answers here is my new code! i need help to get it to working : import java.util.*; public class Quiz { public static void main(String args[]) { String questions[]=("1.What is my favorite hobby?\n" + "(a)hair\n(b)makeup\n(c)both a and b\n", "2.Who first discovered makeup?\n" +"(a)Egyptians\n(b)haitians\n(c)Africans", "3.What glue is best to use when laying down a frontal?\n" + "(a)ghostbond\n(b)boldHold\n(c)Got2b\n" , "4.How many layers of glue do you need before applying a wig onto your head?\n" + "(a)3\n(b)4\n(c)1\n", "5.Always get a shade lighter than your skin when using\n" + "(a)contour\n(b)concealer\n(c)foundation\n", "6.What type of makeup brush would you use to blend your foundation?\n" + "(a)powder brush\n(b)body brush\n(c)neither\n", "7.How long do you suppose to keep a lace front wig installment in your head?\n" + "(a)4 weeks\n(b)2-3 weeks\n(c)5 weeks\n", "8.What do you use to remove makeup off your face?\n" + "(a)baby wipes\n(b)Neutrogena Cleansing towlettes\n(c)clorox wipes\n", "9.What is the BEST way to remove lace glue from your hair?\n" + "(a)alcohol\n(b)shampoo\n(c)water\n", "10.When did the early Egyptians contrust their first wig?\n" + "(a)2700 B.C.E\n(b)2400 B.C.E\n(c)2500 B.C.E\n"); int i,j,c = 0; char quest_answers[]= {"c","a","a","a","b","c","b","b","a","a"}; char answers; Scanner input = new Scanner(System.in); for(i=0; i<10; i++) { System.out.println(questions[i]); System.out.println("A.true"); System.out.println("b.false"); answers = input.nextLine().charAt(0); if(answers==quest_answers[i]) { System.out.println("Correct"); c++; } else { System.out.println("the correct answer is" + quest_answers[i]); } } System.out.println("Number of correct answers are" +c); } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

this practice assignement wants me to Write an application that contains an array of 10 multiple-choice quiz questions related to your favorite hobby. Each question contains three answer choices. Also create an array that holds the correct answer to each question—A, B, or C. Display each question and verify that the user enters only A, B, or C as the answer—if not, keep prompting the user until a valid response is entered. If the user responds to a question correctly, display Correct!; otherwise, display The correct answer is and the letter of the correct answer. After the user answers all the questions, display the number of correct and incorrect answers

here is my new code! i need help to get it to working :

import java.util.*;
public class Quiz {
public static void main(String args[])
{
String questions[]=("1.What is my favorite hobby?\n" + "(a)hair\n(b)makeup\n(c)both a and b\n", "2.Who first discovered makeup?\n" +"(a)Egyptians\n(b)haitians\n(c)Africans", "3.What glue is best to use when laying down a frontal?\n" + "(a)ghostbond\n(b)boldHold\n(c)Got2b\n" , "4.How many layers of glue do you need before applying a wig onto your head?\n" + "(a)3\n(b)4\n(c)1\n", "5.Always get a shade lighter than your skin when using\n" + "(a)contour\n(b)concealer\n(c)foundation\n", "6.What type of makeup brush would you use to blend your foundation?\n" + "(a)powder brush\n(b)body brush\n(c)neither\n", "7.How long do you suppose to keep a lace front wig installment in your head?\n" + "(a)4 weeks\n(b)2-3 weeks\n(c)5 weeks\n", "8.What do you use to remove makeup off your face?\n" + "(a)baby wipes\n(b)Neutrogena Cleansing towlettes\n(c)clorox wipes\n", "9.What is the BEST way to remove lace glue from your hair?\n" + "(a)alcohol\n(b)shampoo\n(c)water\n", "10.When did the early Egyptians contrust their first wig?\n" + "(a)2700 B.C.E\n(b)2400 B.C.E\n(c)2500 B.C.E\n");
int i,j,c = 0;
char quest_answers[]= {"c","a","a","a","b","c","b","b","a","a"};
char answers;
Scanner input = new Scanner(System.in);
for(i=0; i<10; i++)
{
System.out.println(questions[i]);
System.out.println("A.true");
System.out.println("b.false");
answers = input.nextLine().charAt(0);
if(answers==quest_answers[i])
{
System.out.println("Correct");
c++;
}
else
{
System.out.println("the correct answer is" + quest_answers[i]);
}
}
System.out.println("Number of correct answers are" +c);

}
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY