Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an application that displays a series of at least four survey questions ;

ID: 3790866 • Letter: W

Question

Write an application that displays a series of at least four survey questions ; the survey can be on any social or political topic you like. Each questions should have two possible numeric-choice answers. At the end of the survey, use a dialog box to ask whether a user wants to (1) enter another set of responses to the same questions, or (2) quit. Continue to accept sets of responses until the user chooses to quit. Then display the results of the survey – for each question indicate how many users chose the first option or second option. Format the output in an order way which is user-friendly and is easy to digest.

Explanation / Answer

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class ProblemQuiz {
private static int score = 0;
public static void start(){
int value;
BufferedReader bReader = new BufferedReader (new
InputStreamReader(System.in));
try {
System.out.println("Question No1: ");
System.out.println("Who had won 2017 Australian Open?");
System.out.println("1: Federer 2: Nadal;);
System.out.println("3: Paes 4: Djokovic;);
String data = bReader.readLine();
value = Integer.parseInt(data);
switch(value){
case 1:score++;break;
case 2: break;
case 3:break;
case 4:break;
default:break;
}
System.out.println("Question No2: ");
System.out.println("Which country is Hosting FIFA 2022?");
System.out.println("1: USA 2: Qatar");
System.out.println("3: UK 4: Beijing;);
data = bReader.readLine();
value = Integer.parseInt(data);
switch(value){
case 1:break;
case 2:score++;break;
case 3:break;
case 4:break;
default:break;
}
System.out.println("Question No3: ");
System.out.println("Which club do Messi Play for?");
System.out.println("1: Real Madrid 2: Madird;);
System.out.println("3: Barcelona 4: Manchester;);
data = bReader.readLine();
value = Integer.parseInt(data);
switch(value){
case 1:break;
case 2:break;
case 3:score++;break;
case 4:break;
default:break;
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args){
System.out.println("Welcome to Quiz!");
start();
System.out.println("Your score is: "+score);
System.out.println("1. Enter another set of responses to the same set of
questions");
System.out.println("2. Quit");
BufferedReader bReader = new BufferedReader (new
InputStreamReader(System.in));
String data;
try {
data = bReader.readLine();
int value = Integer.parseInt(data);
switch(value){
case 1:score=0;start();System.out.println("Your quiz score is: "+score);break;
case 2:System.exit(1);
default:System.exit(1);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote