Assignemnt #89, Baby Blackjack
Code
import java.util.Random;
public class prog89
{
public static void main( String[] args )
{
Random r = new Random();
int w, x, y, z;
w = 1 + r.nextInt(10);
x = 1 + r.nextInt(10);
y = 1 + r.nextInt(10);
z = 1 + r.nextInt(10);
System.out.println( "Baby Blackjack!\n\nYou drew " + w + " and " + x + ".\nYour total is " + (w+x) + ".\n\nThe dealer has " + y + " and " + z + ".\nDealer's total is " + (y+z) + ".\n" );
if ( (w+x) > (y+z) )
System.out.println( "You Win!" );
else if ( (w+x) < (y+z) )
System.out.println( "You Lose!" );
else if ( (w+x) == (y+z) )
System.out.println( "Tie!" );
}
}
Picture of the output