Assignemnt #39 and A Little Quiz
Code
///Name: Dakota Donahue
///Period: 5
///Project Name: A Little Quiz
///File Name: ALittleQuiz
///Date: 10/15/2015
import java.util.Scanner;
public class ALittleQuiz
{
public static void main ( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String ready;
int a1, a2, a3, c;
System.out.print( " Are you ready for a quiz? " );
ready = keyboard.next();
System.out.println( " Okay, here it comes!" );
System.out.println( " Q1) What is the capitol of The Netherlands? " );
System.out.println( " 1) Rotterdam" );
System.out.println( " 2) Amsterdam" );
System.out.println( " 3) Bratislava" );
System.out.println( " > " );
a1 = keyboard.nextInt();
if ( a1 == 1 )
{
System.out.println( " That is incorrect. " );
}
else if ( a1 == 2 )
{
System.out.println( " That is correct. " );
}
else if ( a1 == 3 )
{
System.out.println( " That's not even in The Netherlands! " );
}
else
{
System.out.println( " That was not an option. ");
}
System.out.println( " Q2) In what year did the Saint Bartholomew's Day Massacre occur? " );
System.out.println( " 1) 1485" );
System.out.println( " 2) 1508" );
System.out.println( " 3) 1572" );
System.out.println( " > " );
a2 = keyboard.nextInt();
if ( a2 == 1 )
{
System.out.println( " That is incorrect, wrong century. " );
}
else if ( a2 == 2 )
{
System.out.println( " That is incorrect. " );
}
else if ( a2 == 3 )
{
System.out.println( " That is correct. " );
}
else
{
System.out.println( " That was not an option. ");
}
System.out.println( " Q3) What is the approximate speed at which Earth revolves and the Sun? " );
System.out.println( " 1) 56,000 km/h " );
System.out.println( " 2) 108,000 km/h " );
System.out.println( " 3) 135,000 km/h " );
System.out.println( " > " );
a3 = keyboard.nextInt();
if ( a3 == 1 )
{
System.out.println( " That is incorrect, a year would be over 700 days long if this were the case. " );
}
else if ( a3 == 2 )
{
System.out.println( " That is correct. " );
}
else if ( a3 == 3 )
{
System.out.println( " That is incorrect. " );
}
else
{
System.out.println( " That was not an option. ");
}
c = 0;
if ( a1 == 1 && a2 == 1 && a3 == 1 )
{
c = 0;
}
else if ( a1 == 1 && a2 == 1 && a3 == 2 )
{
c = 1;
}
else if ( a1 == 1 && a2 == 1 && a3 == 3 )
{
c = 0;
}
else if ( a1 == 1 && a2 == 2 && a3 == 1 )
{
c = 0;
}
else if ( a1 == 1 && a2 == 2 && a3 == 2 )
{
c = 1;
}
else if ( a1 == 1 && a2 == 2 && a3 == 3 )
{
c = 0;
}
else if ( a1 == 1 && a2 == 3 && a3 == 1 )
{
c = 1;
}
else if ( a1 == 1 && a2 == 3 && a3 == 2 )
{
c = 2;
}
else if ( a1 == 1 && a2 == 3 && a3 == 3 )
{
c = 1;
}
else if ( a1 == 2 && a2 == 1 && a3 == 1 )
{
c = 1;
}
else if ( a1 == 2 && a2 == 1 && a3 == 2 )
{
c = 2;
}
else if ( a1 == 2 && a2 == 1 && a3 == 3 )
{
c = 1;
}
else if ( a1 == 2 && a2 == 2 && a3 == 1 )
{
c = 1;
}
else if ( a1 == 2 && a2 == 2 && a3 == 2 )
{
c = 2;
}
else if ( a1 == 2 && a2 == 2 && a3 == 3 )
{
c = 1;
}
else if ( a1 == 2 && a2 == 3 && a3 == 1 )
{
c = 1;
}
else if ( a1 == 2 && a2 == 3 && a3 == 2 )
{
c = 3;
}
else if ( a1 == 2 && a2 == 3 && a3 == 3 )
{
c = 1;
}
else if ( a1 == 3 && a2 == 1 && a3 == 1 )
{
c = 0;
}
else if ( a1 == 3 && a2 == 1 && a3 == 2 )
{
c = 1;
}
else if ( a1 == 3 && a2 == 1 && a3 == 3 )
{
c = 0;
}
else if ( a1 == 3 && a2 == 2 && a3 == 1 )
{
c = 0;
}
else if ( a1 == 3 && a2 == 2 && a3 == 2 )
{
c = 1;
}
else if ( a1 == 3 && a2 == 2 && a3 == 3 )
{
c = 0;
}
else if ( a1 == 3 && a2 == 3 && a3 == 1 )
{
c = 1;
}
else if ( a1 == 3 && a2 == 3 && a3 == 2 )
{
c = 2;
}
else if ( a1 == 3 && a2 == 3 && a3 == 3 )
{
c = 1;
}
else
{
System.out.println( " You did not correctly complete the quiz. " );
}
System.out.println( " Overall, you got " + c + " out of 3 correct. " );
System.out.println( " Thanks for playing! " );
}
}