You are on page 1of 3

Survey.

java
import java.util.Scanner;

public class Survey {


public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String answer,Ans1, Ans2,Ans3,Ans4;

do {
System.out.println("1.Which fruit among these do you want to eat? ");
System.out.println("a.fruit");
System.out.println("b.vegetables");
System.out.println("c.meat");

System.out.println("Enter your answer:");


Ans1 = input.next();

System.out.println("2.Gender ");
System.out.println("a.Male");
System.out.println("b.Female");
System.out.println("c.LGBT");

System.out.println("Enter your answer:");


Ans2 = input.next();

System.out.println("2.what does the acronym ICT stand for? ");


System.out.println("a.Information and Communications Technology ");
System.out.println("b.information and computer technology");
System.out.println("c.I Care too");

System.out.println("Enter your answer:");


Ans3 = input.next();

System.out.println("4.What is the best weapon for Covid 19 virus? ");


System.out.println("a.Social distancing,always wear face shied and
facemask and always wash your hand ");
System.out.println("b.just alcohol");
System.out.println("c.vanguard");

System.out.println("Enter your answer:");


Ans4 = input.next();

System.out.println("Your answer:");

System.out.print("Do you want to try again? y/n \n");


answer = input.next();
}while (answer.equals("y"));

if (Ans1.equals("a")) {
System.out.println("a.fruit");

} else if (Ans1.equals("b")) {
System.out.println("b.vegetables");

} else if (Ans1.equals("c")) {
System.out.println("c.meat");
} else
System.out.print("your answer is invalid please try again");
//---------------------------------------------------------------------------
-//
if (Ans2.equals("a")) {
System.out.println("a.Male");

} else if (Ans2.equals("b")) {
System.out.println("b.Female");

} else if (Ans2.equals("c")) {
System.out.println("c.LGBT");
} else
System.out.print("your answer is invalid please try again");
//---------------------------------------------------------------------------
-//
if (Ans3.equals("a")) {
System.out.println("a.Information and Communications
Technology");

} else if (Ans3.equals("b")) {
System.out.println("b.information and computer technology");

} else if (Ans3.equals("c")) {
System.out.println("c.I Care too");
} else
System.out.print("your answer is invalid please try again");
//---------------------------------------------------------------------------
-//
if (Ans4.equals("a")) {
System.out.println("a.Social distancing,always wear face shied
and facemask and always wash your hand ");

} else if (Ans4.equals("b")) {
System.out.println("b.just alcohol");

} else if (Ans4.equals("c")) {
System.out.println("c.vanguard");
} else
System.out.print("your answer is invalid please try again");
}

You might also like