Assignment #89 Baby Blackjack
Code
/// Name: Matthew Lorence
/// Period: 5
/// Program Name: Baby Blackjack
/// File Name: BabyBlackjack.java
import java.util.Random;
public class BabyBlackjack
{
public static void main (String[] args)
{
Random r = new Random();
int x1 = 1+r.nextInt(10);
int x2 = 1+r.nextInt(10);
int y1 = 1+r.nextInt(10);
int y2 = 1+r.nextInt(10);
int x=x1+x2;
int y=y1+y2;
System.out.println("Baby Blackjack!\n");
System.out.println("Your drew " + x1 + " and " + x2 + ".");
System.out.println("Your total is " + x + ".\n");
System.out.println("The dealer has " + y1 + " and " + y2 + ".");
System.out.println("Dealer's total total is " + y + ".\n");
if (x>y)
{
System.out.println("YOU WIN!");
}
else if (x==y)
{
System.out.println("YOU TIED!");
}
else
{
System.out.println("YOU LOSE!");
}
}
}
Picture of the output