ThreeCards
Code
import java.util.Random;
import java.util.Scanner;
public class ThreeCards
{
public static void main ( String[] args )
{
Scanner keyboard = new Scanner(System.in);
Random r = new Random();
int ans;
int choice = 1 + r.nextInt(3);
String response1 = "", response2 = "", response3 = "";
if ( choice == 1 )
{
response1 = " aa ## ## " ;
response2 = " aa ## ## " ;
response3 = " 1 2 3 " ;
}
else if ( choice == 2 )
{
response1 = " ## aa ## " ;
response2 = " ## aa ## " ;
response3 = " 1 2 3 " ;
}
else if ( choice == 3 )
{
response1 = " ## ## aa " ;
response2 = " ## ## aa " ;
response3 = " 1 2 3 " ;
}
System.out.println( " ## ## ## " );
System.out.println( " ## ## ## " );
System.out.println( " 1 2 3 " );
System.out.println( "");
System.out.println( " Choose a card any card " );
ans = keyboard.nextInt();
if ( ans == choice )
{
System.out.println( "" + response1 );
System.out.println( "" + response2 );
System.out.println( "" + response3 );
System.out.println( " Correct!!!" );
}
else if ( ans > choice && ans < choice )
{
System.out.println( "" + response1 );
System.out.println( "" + response2 );
System.out.println( "" + response3 );
System.out.println( " nope it was " + choice );
}
}
}
ThreeCards