Answer to Question #8766 in Java | JSP | JSF for wilfred

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
1
Expert's answer
2012-04-27T10:30:01-0400
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!

Comments

Ntuthuko
01.04.18, 01:59

I am so Grateful! please do me a favor, don't you dare stop being Awesome (You're a life saver).

Assignment Expert
22.05.14, 16:36

Dear James, You're welcome. We are glad to be helpful. If you liked our service please press like-button beside answer field. Thank you!

Lloyd
21.05.14, 01:58

Wow

james
16.05.14, 14:16

Thanks for the help!!

Assignment Expert
08.05.12, 14:59

You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!

Thabang
01.05.12, 07:05

Thanx, keep up the good work!

Assignment Expert
28.04.12, 16:37

You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!

Wilfred
27.04.12, 20:02

Thanx for the help!!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS