Assignment 89, Baby Blackjack
Code
///Name: Stella Koliavas
///Period: 5
///File Name: BabyBlackjack.java
///Date Finshed: 2/25/16
import java.util.Random;
public class BabyBlackjack
{
public static void main ( String[] args )
{
Random r = new Random();
int x = 1 + r.nextInt(10);
int y = 1 + r.nextInt(10);
int suma = (x + y);
int a = 1 + r.nextInt(10);
int b = 1 + r.nextInt(10);
int sumb = (a + b);
System.out.println("You drew "+ x +" and "+ y+".");
System.out.println("Your total is "+ suma+".");
System.out.println(" ");
System.out.println("The dealer drew "+a+" and "+b+ ".");
System.out.println("The dealer's total is "+sumb+ ".");
if (suma > sumb )
{
System.out.println("You win!");
}
if (suma < sumb || suma == sumb)
System.out.println("You lost!");
}
}
Picture of the output