package quizAdvanced;
import java.util.*;
public class quizAdvanced {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String[] a = new String[5];
String[] b = new String[5];
String[] c = new String[5];
int count = 0;
String answer;
int correct = 0;
int wrong = 0;
a[0] = "G. Bush Jr.";
a[1] = "Obama";
a[2] = "Lincoln";
a[3] = "Washington";
a[4] = "Papandreou";
b[0] = "Apple";
b[1] = "Motorola";
b[2] = "Lenovo";
b[3] = "Sony";
b[4] = "Google";
c[0] = "Doha";
c[1] = "Boha";
c[2] = "Al Khtor";
c[3] = "Loha";
c[4] = "Dammam";
while (count < 3) {
switch (count) {
case 0:
System.out.printf("%s\n \na) %s\nb) %s\nc) %s\nd) %s\ne) %s\n %s\n", "Who is the president of U.S.A?",
a[0],a[1],a[2],a[3],a[4], "Enter the answer: ");
answer = input.nextLine();
if (answer == "b" || answer == "Obama")
++correct;
else
++wrong;
break;
case 1:
System.out.printf("%s\n \na) %s\nb) %s\nc) %s\nd) %s\ne) %s\n %s\n", "Which company of the following created Android software?",
b[0],b[1],b[2],b[3],b[4], "Enter the answer: ");
answer = input.nextLine();
if (answer == "e" || answer == "Google")
++correct;
else
++wrong;
break;
default:
System.out.printf("%s\n \na) %s\nb) %s\nc) %s\nd) %s\ne) %s\n %s\n", "What's the capital of Qatar?",
c[0],c[1],c[2],c[3],c[4], "Enter the answer: ");
answer = input.nextLine();
if (answer == "a" || answer == "Doha")
++correct;
else
++wrong;
break;
}
++count;
}
System.out.println("Results: ");
if (correct == 3)
System.out.println("Congrats! 3 out of 3.");
else if (correct == 2)
System.out.println("Good,but you could be better.");
else
System.out.println("You failed!");
System.out.println(correct +" - " + wrong);
}
}