Assignemnt #39
Code
///Colin Hinton
///5th period
///Quiz
///Quiz.java
///10/5/2015
import java.util.Scanner;
public class Quiz
{
public static void main(String [] args)
{
Scanner keyboard = new Scanner(System.in);
String response;
int questionOne, questionTwo, questionThree, score;
score = 0;
System.out.print("Are you ready for a quiz? ");
response = keyboard.next();
System.out.print("Okay, here it comes!");
System.out.println("Q1) What is the color of cheese?");
System.out.print(" 1) Yellow");
System.out.print(" 2) Blue");
System.out.print(" 3) Green");
System.out.println();
questionOne = keyboard.nextInt();
System.out.println();
if (questionOne == 1)
{
System.out.print("That is correct!");
score = score + 1 ;
}
else
{
System.out.print("Im sorry yellow is what we were looking for");
}
System.out.println();
System.out.println("Q2) Can jeans be the color blue?");
System.out.print(" 1) Yes");
System.out.print(" 2) No");
System.out.println();
questionTwo = keyboard.nextInt();
System.out.println();
if (questionTwo == 1)
{
System.out.print("That is correct!");
score =score + 1 ;
}
else
{
System.out.print("Im sorry but most jeans are blue");
}
System.out.println();
System.out.println("Q3) What is the name of the song made to promote the 2014 League of Legends World Championship?");
System.out.print(" 1) Worlds Collide");
System.out.print(" 2) Wake Me Up Inside");
System.out.print(" 3) Warriors");
System.out.println();
questionThree = keyboard.nextInt();
System.out.println();
if (questionThree == 3)
{
System.out.print("That is correct!");
score = score + 1 ;
}
else
{
System.out.print("Im sorry but that is not correct");
}
System.out.println();
System.out.println("Overall you got " + score + " out of 3 correct.");
}
}
Picture of the output