Assignment #39 A Little Quiz
Code
/// Name: Lacey Reese
/// Period: 5
/// Program Name: ALittleQuiz
/// File Name: ALittleQuiz.java
/// Date Finished 10/29/2015
import java.util.Scanner;
public class ALittleQuiz
{
public static void main( String[] args )
{
Scanner Lacey= new Scanner(System.in);
int Q1, Q2, Q3;
int correct=0;
System.out.println ( "Are you ready for a little quiz? " );
System.out.println ( "Okay here it comes!" );
System.out.println();
System.out.println( "(Q1) What is Nebraska known for? " );
System.out.println("\t 1) soda " );
System.out.println("\t 2) corn " );
System.out.println("\t 3) cherries " );
System.out.print( "> " );
Q1 = Lacey.nextInt();
if ( Q1 == 1 )
{
System.out.println( " That is a dumb answer!! Try again " );
}
else if ( Q1 == 2 )
{
System.out.println( " YOU KNOW SOMETHING! Yay you got it correct! " );
correct=correct +1;
}
else
{
System.out.println( " Uhh you need to go back to elementary school hunny bunny " );
}
System.out.println();
System.out.println( "(Q2) Are cats are the best animal in the world?");
System.out.println( "\t 1) True " );
System.out.println( "\t 2) False " );
System.out.println( "\t 3) Cats suck " );
System.out.print( "> " );
Q2 = Lacey.nextInt();
if ( Q2 == 1 )
{
System.out.println( " That is the best answer. Cats are amazing. Fat and fluffy! " );
correct=correct+1;
}
else if (Q2 == 2 )
{
System.out.println( " You need to have a reality check, guess again. " );
}
else
{
System.out.println( " Im sorry you are going to be exiled out of this country, very disrespectul to cat lovers. " );
}
System.out.println();
System.out.println( "(Q3) What is 2+8/2?");
System.out.println( "\t 1) 3 " );
System.out.println( "\t 2) 5 " );
System.out.println( "\t 3) I dont understand the question? " );
System.out.print( "> " );
Q3 = Lacey.nextInt();
if ( Q3 == 1 )
{
System.out.println( " You definatly need to rethink your math skills" );
}
else if ( Q3 == 2 )
{
System.out.println( " You PASSED! Good work. " );
correct=correct+1;
}
else
{
System.out.println( " Don't bother..... " );
}
System.out.println();
System.out.println( " You got " + correct + "out of 3 correct " );
System.out.println( " Thanks for playing !! " );
}
}
Picture of the output
// This was really frustrating