Assignemnt #39
Code
/// Name: Ryan Volko
/// Period: 7
/// Program Name: Little Quiz Program
/// File Name: littleQuiz.java
/// Date Finished: 10/27/2015
import java.util.Scanner;
public class LittleQuiz
{
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
String quiz;
int Q1, Q2, Q3;
System.out.println( "Are you ready for a quiz? ");
quiz =keyboard.next();
System.out.println( "Too bad here it comes anyway. ");
System.out.println( " ");
System.out.println( " ");
System.out.println( "Q1. What is the height of the Empire State building? ");
System.out.println( " 1. 1,453 ft ");
System.out.println( " 2. 1,452 ft ");
System.out.println( " 3. 1,454 ft ");
System.out.print( "> ");
Q1 = keyboard.nextInt();
System.out.println( " ");
System.out.println( " ");
if ( Q1 == 3)
{
System.out.println( "That's right ");
}
else
{
System.out.println( "Some student you are, this was covered in third grade. ");
}
System.out.println( " ");
System.out.println( " ");
System.out.println( "Q2. What is the greatest band of all time? ");
System.out.println( " 1. Rolling Stones ");
System.out.println( " 2. The Beatles ");
System.out.println( " 3. Chumbawumba ");
System.out.print( "> ");
Q2 = keyboard.nextInt();
System.out.println( " ");
System.out.println( " ");
if ( Q2 == 3)
{
System.out.println( "That's right, congrats ");
}
else
{
System.out.println( "You obviously will fail in life. ");
}
System.out.println( " ");
System.out.println( " ");
System.out.println( "Q3. What is the darkest color? ");
System.out.println( " 1. Black ");
System.out.println( " 2. Brown ");
System.out.print( "> ");
Q3 = keyboard.nextInt();
System.out.println( " ");
System.out.println( " ");
if ( Q3 == 2)
{
System.out.println( "That's right. ");
}
else
{
System.out.println( "That's wrong, black is a value not a color. ");
}
System.out.println( " ");
System.out.println( " ");
if ( Q1 == 3 && Q2 == 3 && Q3 == 2)
{
System.out.println( " Congrats you got 3/3 you are awesome. ");
}
else if ( Q1 == 3 && Q2 == 3 )
{
System.out.println( " You got 2/3 you are below average. ");
}
else if ( Q1 == 3 && Q3 == 2 )
{
System.out.println( " You got 2/3 you are below average. ");
}
else if ( Q2 == 3 && Q3 == 2 )
{
System.out.println( " You got 2/3 you are below average. ");
}
else if ( Q1 == 3 )
{
System.out.println( " You got 1/3 you are just awful. ");
}
else if ( Q2 == 3 )
{
System.out.println( " You got 1/3 you are just awful. ");
}
else if ( Q3 == 2 )
{
System.out.println( " You got 1/3 you are just awful. ");
}
else
{
System.out.println( " Congrats you got 0/3 three you will most definitly flunk school. ");
}
}
}
Picture of the output