Assignemnt #39 and Quiz.java
Code
/// Name: Boris Kazantsev
/// Period: 6
/// Program Name: Quiz
/// File Name: Quiz.java
/// Date Finished: 11/21/2015
import java.util.Scanner;
public class Quiz{
public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);
int Q1, Q2, Q3, result;
String respond;
System.out.print("Are you ready for a quiz? ");
respond = keyboard.next();
System.out.println("Okay, here it comes!");
System.out.println();
result = 0;
System.out.println("Q1) What is the capital of Mother Russia?");
System.out.println(" 1) Borscht?");
System.out.println(" 2) Putin");
System.out.println(" 3) Moscow");
System.out.println();
System.out.print("> ");Q1 = keyboard.nextInt();
if ( Q1 == 1){
System.out.println();
System.out.println(" Wrong! " );
System.out.println();
}
else if ( Q1 == 2){
result += 1;
System.out.println();
System.out.println(" That's right! " );
System.out.println();
}
else if ( Q1 == 3){
System.out.println();
System.out.println(" Wrong!!! " );
System.out.println();
}
System.out.println("Q2) Does America Suck");
System.out.println(" 1) No");
System.out.println(" 2) Yes");
System.out.println();
System.out.print("> ");Q2 = keyboard.nextInt();
if ( Q2 == 1){
System.out.println();
System.out.println(" Wrong!!! " );
System.out.println();
}
else if( Q2 == 2){
result += 1;
System.out.println();
System.out.println("CORRECT!! " );
System.out.println();
}
System.out.println("Q3) Is Putin a great leader?");
System.out.println(" 1) Yes!");
System.out.println(" 2) Best Leader in the World!!");
System.out.println(" 3) I'd rather have my piroshki");
System.out.println();
System.out.print("> ");Q3 = keyboard.nextInt();
if (Q3 == 1) {
result += 1;
System.out.println();
System.out.println("CORRECT!! " );
System.out.println();
}
else if (Q3 == 2){
System.out.println();
System.out.println(" That's what they all say... KIll him!!!" );
System.out.println();
}
else if (Q3 == 3) {
System.out.println();
System.out.println(" WRONG!!!! " );
System.out.println();
}
System.out.println("Overall, you got " + result + " out of 3!!!!");
System.out.println("Thank you for palying!!");
System.out.println();
}
}
Picture of the output