Bab
import java.util.Random;
public class bab
{
public static void main( String[] args )
{
Random r = new Random();
int p1 = 1 + r.nextInt(10);
int p2 = 1 + r.nextInt(10);
int d1 = 1 + r.nextInt(10);
int d2 = 1 + r.nextInt(10);
int pTotal = p1 + p2;
int dTotal = d1 + d2;
System.out.println( "Baby Blackjack" );
System.out.println();
System.out.println( "You drew " + p1 + " and " + p2 + "." );
System.out.println( "Your total = " + pTotal + "." );
System.out.println();
System.out.println( "The dealer has a " + d1 + " and " + d2 + "." );
System.out.println( "Dealer's total is " + dTotal + "." );
if ( pTotal > dTotal ) {
System.out.println( "You win" );
}
else if ( pTotal < dTotal ) {
System.out.println( "You lose" );
}
else {
System.out.println( "You tied" );
}
}
}
Picture of the output