Assignment 39; Quiz
Code
// Donovan Rich
// Period 6
// A Little Quiz
// Quiz.java
// 10/19/2015
import java.util.Scanner;
public class Quiz {
public static void main( String[] args ) {
Scanner keyboard = new Scanner(System.in);
int points=0, answer;
System.out.println( "How many cations are required to power an econ-grade neuroflux capacitor?" );
System.out.println( "1) 186" );
System.out.println( "2) 1900" );
System.out.println( "3) 1.86x10^43" );
System.out.println( "4) None of the above" );
System.out.print ( "---> " );
answer = keyboard.nextInt();
if ( answer == 3 )
{
points += 1;
}
System.out.println( "The N-19 model of the GeoTherm[TM] hydrocell capacitive engine" );
System.out.println( "has an average life expectancy of how many years?" );
System.out.println( "1) 6" );
System.out.println( "2) 25" );
System.out.println( "3) 12" );
System.out.println( "4) 17" );
System.out.print ( "---> " );
answer = keyboard.nextInt();
if ( answer == 2 )
{
points += 1;
}
System.out.println( "What mass of gravitons is typically utilized by" );
System.out.println( "the MIL-SPEC GH-II Portable Antimatter Cannon (PAC) with a" );
System.out.println( "single firing, in nanograms?" );
System.out.println( "1) 34" );
System.out.println( "2) 2x10^(-14)" );
System.out.println( "3) 1.3x10^(-4)" );
System.out.println( "4) 0.6664" );
System.out.print ( "---> " );
answer = keyboard.nextInt();
if ( answer == 2 )
{
points += 1;
}
System.out.println( "Gamma 3, the solar system home to the Hor'Drah, a xenophobic" );
System.out.println( "race of bipedal felines, are currently at war with which megacorp?" );
System.out.println( "1) BlueRike Enterprises" );
System.out.println( "2) Vibe-Vird" );
System.out.println( "3) Encephalon" );
System.out.println( "4) Gauntlet, inc." );
System.out.print ( "---> " );
answer = keyboard.nextInt();
if ( answer == 4 )
{
points += 1;
}
System.out.println( "Trainee, you answered " + points + " out of 4 questions correctly." );
if ( points == 4 )
{
System.out.println( "You are now eligible for a Captain's license." );
}
else { System.out.println( "Please review the reading material before retaking this quiz." ); }
}
}
Picture of the output