Assignemnt #60
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: Three
/// File Name: Three.java
/// Date Finished: 10/30/2015
import java.util.Random;
import java.util.Scanner;
public class Three
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int y, x = 1 + r.nextInt(3);
System.out.println("There are three cards two are jacks and one is an ace");
System.out.println("");
System.out.println("Which one is it?");
System.out.println("");
System.out.println(" ## ## ##");
System.out.println(" ## ## ##");
System.out.println(" 1 2 3 " );
System.out.println("");
System.out.print("> ");
y = keyboard.nextInt();
if ( x == 1 )
{
if (y == x)
{
System.out.println("You got it right");
System.out.println("");
System.out.println(" AA ## ## ");
System.out.println(" AA ## ##");
System.out.println(" 1 2 3 ");
System.out.println("");
}
else
{
System.out.println("Nope it was 1");
System.out.println("");
System.out.println(" AA ## ## ");
System.out.println(" AA ## ##");
System.out.println(" 1 2 3 ");
System.out.println("");
}
}
else if ( x == 2 )
{
if ( y == x )
{
System.out.println("You got it right");
System.out.println("");
System.out.println(" ## AA ## ");
System.out.println(" ## AA ##");
System.out.println(" 1 2 3 ");
System.out.println("");
}
else
{
System.out.println("nope it was 2");
System.out.println("");
System.out.println(" ## AA ## ");
System.out.println(" ## AA ##");
System.out.println(" 1 2 3 ");
System.out.println("");
}
}
else if ( x == 3 )
{
if ( x == y )
{
System.out.println("You got it right");
System.out.println("");
System.out.println(" ## ## AA ");
System.out.println(" ## ## AA");
System.out.println(" 1 2 3 ");
System.out.println("");
}
else
{
System.out.println("nope it was 3");
System.out.println("");
System.out.println(" ## ## AA ");
System.out.println(" ## ## AA");
System.out.println(" 1 2 3 ");
System.out.println("");
}
}
}
}
Picture of the output