Assignemnt #89: Baby Blackjack
Code
/// Name: Kelsey Lieberman
/// Period 5
/// Program Name: BabyBlackjack
/// File Name: BabyBlackjack.java
/// Date Finished: 1/11/2016
import java.util.Random;
public class BabyBlackjack
{
public static void main(String[] args) throws Exception
{
Random r = new Random();
int p1 = 1 + r.nextInt(10), p2 = 1 + r.nextInt(10), d1 = 1 + r.nextInt(10), d2 = 1 + r.nextInt(10), pT, dT;
System.out.println("\nBaby Blackjack!!!");
Thread.sleep(1000);
System.out.println("\nYou drew a " + p1 + " and a " + p2 + ".");
System.out.println("Your total is " + (p1 + p2) + ".");
System.out.println("\nThe dealer has a " + d1 + " and a " + d2 + ".");
System.out.println("Dealer's total is " + (d1 + d2) + ".");
if ((d1 + d2) == (p1 + p2))
System.out.println("\nPUSH.");
else if ((d1 + d2) < (p1 + p2))
System.out.println("\nYou Win!!!");
else if ((d1 + d2) > (p1 + p2))
System.out.println("\nYou Lose!!");
}
}
Picture of the output