Assignemnt #39 and A Little Quiz
Code
/// Name: Brian Phillips
/// Period: 5
/// Program name: A Little Quiz
/// File Name: ALittleQuiz.java
/// Date Finished: 10/29/2015
import java.util.Scanner;
public class ALittleQuiz
{
public static void main( String[] args )
{
String ready;
int answer, answer2, answer3, number, correct;
Scanner Keyboard = new Scanner(System.in);
System.out.println( "Who would cross the bridge of death must answer me these questions three Y/N");
ready = Keyboard.next();
correct = 0;
if (ready.equals("Y"))
{
System.out.println( "Good let's start");
}
if (ready.equals("N"))
{
System.out.println( "Too bad you are still taking this test");
}
System.out.println();
System.out.println( "Q1: What is your name?" );
System.out.println( " 1: Barack Obama the Third" );
System.out.println( " 2: 12:58PM " );
System.out.println( " 3: None of the above " );
System.out.println();
answer = Keyboard.nextInt();
if (answer == 1)
{
System.out.println( "Sorry, that name is taken...maybe" );
}
if (answer == 2)
{
System.out.println( "Sorry, that is a time not a name" );
}
if (answer == 3)
{
System.out.println( "Correct!" );
correct = correct + 1;
}
System.out.println( "Q2: What is your quest?" );
System.out.println( " 1: To seek the Holy Grail" );
System.out.println( " 2: To seek the wholesome Grail" );
System.out.println( " 3: To not seek the Holy Grail" );
System.out.println();
answer2 = Keyboard.nextInt();
if (answer2 == 1)
{
System.out.println( "Correct!" );
correct = correct + 1;
}
if (answer2 == 2)
{
System.out.println( "Wrong, your quest is to seek the Holy Grail" );
}
if (answer2 == 3)
{
System.out.println( "Wrong, your quest is to seek the Holy Grail" );
}
System.out.println( "Q3: What, is the capital of Assyria?" );
System.out.println( " 1: What, I don't know that one" );
System.out.println( " 2: NINEVEH " );
System.out.println( " 3: BLUE-no-r" );
System.out.println();
answer3 = Keyboard.nextInt();
if (answer3 == 1)
{
System.out.println( "AHHHHHHHHHHHHHHHHHHHH!!!!!!!! (You were thrown off a bridge)" );
}
if (answer3 == 2)
{
System.out.println( "Right, off you go" );
correct = correct + 1;
}
if (answer3 == 3)
{
System.out.println( "AHHHHHHHHHHHHHHHHHHHH!!!!!!!! (You were thrown off a bridge)" );
}
System.out.println( " You got " + correct + "out of 3 correct " );
}
}
Picture of the output