Assignment #89 and Baby Blackjack
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: Baby BlackJack
/// File Name: BabyBlackJack.java
/// Date Finished: 02/23/2016/
import java.util.Random;
public class BabyBlackJack
{
public static void main(String[] args)
{
Random r = new Random();
int y1, y2, d1, d2;
double yt, dt;
y1 = 1 + r.nextInt(10);
y2 = 1 + r.nextInt(10);
d1 = 1 + r.nextInt(10);
d2 = 1 + r.nextInt(10);
yt = y1 + y2;
dt = d1 + d2;
System.out.println("Baby BlackJack!");
System.out.println("");
System.out.println("You drew a " + y1 + " and " + y2 + ".");
System.out.println("Your total is " + yt);
System.out.println("");
System.out.println("The dealer has a " + d1 + " and " + d2 + ".");
System.out.println("so his total is " + dt);
System.out.println("");
if (yt > dt)
{
System.out.println("YOU WIN!");
}
else if (dt > yt)
{
System.out.println("YOU LOSE!");
}
else
{
System.out.println("IT'S A TIE!");
}
}
}
Picture of the output