Assignment # 89 and Baby Blackjack
Code
/// Name: Tommy Oyuntseren
/// Period: 7
/// Program Name: BabyBlackjack
/// File Name: BabyBlackjack.java
/// Date: 3/3/2016
import java.util.Random;
public class BabyBlackjack
{
public static void main(String[] args)
{
Random r= new Random();
int y1, y2, d1, d2;
y1= 1 + r.nextInt(10);
y2= 1 + r.nextInt(10);
d1= 1 + r.nextInt(10);
d2= 1 + r.nextInt(10);
System.out.println("Baby Blackjack!");
System.out.println("\nYou drew " +y1 +" and " + y2+ ".");
int ytotal= (y1+y2);
System.out.println("Your total is " + ytotal+ ".");
System.out.println("\nThe dealer has " +d1 +" and " + d2 + ".");
int dtotal= (d1+d2);
System.out.println("Your total is " + dtotal +".");
if (ytotal>dtotal)
{
System.out.println("\nYOU WIN!");
}
else if (dtotal>ytotal)
{
System.out.println("\nSorry this round goes to the dealer.");
}
}
}
Picture of the output