Well you write the program and post if you get problems with it. We'd like to help but we don't want to do the whole thing for you.
ok,,use also JOptionPane
public class Survey{
public static void main (String[] args) throws Exception {
String ques1 = new String("Is your family happy? ");
String ques2 = new String("Is your father have a work? ");
String ques3 = new String("Is mother have a work? ");
String ques4 = new String("All of you here studying? ");
String question;
char selection, answer, response;
char another = 'y';
int i;
while (another == 'y') {
int numCorrect = 0;
for (i = 1; i <= 4; i++) {
if (i == 1) {
question = ques1;
answer = 'y';
}
else if (i == 2) {
question = ques2;
answer = 'n';
}
else if (i == 3) {
question = ques3;
answer = 'n';
}
else {
question = ques4;
answer = 'n';
}
System.out.println("Enter y or n for the following questions");
System.out.print(question);
response = (char)System.in.read();
System.in.read();
System.in.read();
if (response == answer) {
System.out.println("Correct!");
numCorrect++;
}
else
System.out.println("Incorrect!" +
"\nCorrect answer is " + answer);
}
System.out.println("\nNumber of correct answers: " + numCorrect);
System.out.print("\nEnter another set of responses (y or n):");
another = (char)System.in.read();
System.in.read();
System.in.read();
}
}
}