Assignemnt #39 and Quiz #1
Code
///Name: Ben Borglin
///Period: 6
///Program Name: A little Quiz
///File Name: Quiz1.java
///Date Finished: 9/28/15
import java.util.Scanner;
public class Quiz
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String rurk;
System.out.print("Are you ready kids?!?!");
rurk = keyboard.next();
if ( rurk == "no" )
{
System.out.print("Well toooooo bad!");
}
else
{
System.out.print("Okay! Here it comes");
}
System.out.println(" ");
int answer, score;
score = 0;
System.out.println("Q1) What is the worst case scenario? ");
System.out.println(" 1)Bear attack ");
System.out.println(" 2)Shark attack ");
System.out.println(" 3)Lightning strike ");
System.out.println(" ");
answer = keyboard.nextInt();
System.out.println(" ");
if ( answer == 1 )
{
System.out.println("That's not correct");
}
if ( answer == 2 )
{
System.out.println("Sorry That is not the right answer.");
}
else if ( answer == 3 )
{
System.out.println("Correct!!!!");
score += 1;
}
System.out.println("Q2) How many seasons are there in japan? ");
System.out.println(" 1)4 ");
System.out.println(" 2)5 ");
System.out.println(" 3)2 ");
System.out.println(" ");
answer = keyboard.nextInt();
System.out.println(" ");
if ( answer == 2 )
{
System.out.println("That's not correct");
}
if ( answer == 3 )
{
System.out.println("Sorry That is not the right answer.");
}
else if ( answer == 1 )
{
System.out.println("Correct!!!!");
score += 1;
}
System.out.println("Q3) How many characters are in the japanese Hiragana alphabet? ");
System.out.println(" 1)21 ");
System.out.println(" 2)26 ");
System.out.println(" 3)46 ");
System.out.println(" ");
answer = keyboard.nextInt();
System.out.println(" ");
if ( answer == 1 )
{
System.out.println("That's not correct");
}
if ( answer == 2 )
{
System.out.println("Sorry That is not the right answer.");
}
else if ( answer == 3 )
{
System.out.println("Correct!!!!");
score += 1;
}
System.out.println("Overall, you got " + score + " of out 3 correct.");
System.out.println("Thanks for playing!");
}
}
Picture of the output