Question #8766

write a application that display a series of at least four survey question;the survey can be on any social or political topic,each question should have at least three possible numeric choice answers.at the end the survey,use a dialog box to ask whether the user wantsto
1.enter another set of responses to the same set of questions
2. quit
continue to accept the sets of responses until the user chooses to quit,and then display the results of the survey for each question indicate how many users chose the first option,second option,and so on

Expert's 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 N1: ");
System.out.println("Who starred as Rocky Balboa?");
System.out.println("1: Arnold Schwarzenegger 2: Sylvester Stallone");
System.out.println("3: Brad Pitt 4: Chuck Norris");
String 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 N2: ");
System.out.println("Who invented the television?");
System.out.println("1: John Logie Baird 2: Chuck Norris");
System.out.println("3: Louis Bleriot 4: Lady Chatterlys Lover");
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 N3: ");
System.out.println("Who sang the theme song in 9 to 5?");
System.out.println("1: Victoria Cross 2: Louis Bleriot");
System.out.println("3: Walt Disney 4: Dolly Parton");
data = bReader.readLine();
value = Integer.parseInt(data);
switch(value){
case 1:break;
case 2:break;
case 3:break;
case 4:score++;break;
default:break;
}
System.out.println("Question N4: ");
System.out.println("Who did Michael Caine play in the Ipcress File?");
System.out.println("1: Chuck Norris 2: Harry Palmer");
System.out.println("3: John Constable 4: Oliver Hardy");
data = bReader.readLine();
value = Integer.parseInt(data);
switch(value){
case 1:break;
case 2:score++;break;
case 3: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 score is: "+score);break;
case 2:System.exit(1);
default:System.exit(1);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS