Assignemnt #89 and Baby Blackjack
Code
/// Name: David Shkolnikov
/// Period: 6
/// Program Name: Baby Blackjack
/// File Name: BabyBlackjack.java
/// Date Finished: 3/2/2016
import java.util.Random;
public class BabyBlackjack
{
public static void main( String[] args )
{
System.out.println("Baby Blackjack!");
Random r = new Random();
int card1, card2, dealer1, dealer2, total1, total2;
card1 = 1 + r.nextInt(10);
card2 = 1 + r.nextInt(10);
dealer1 = 1 + r.nextInt(10);
dealer2 = 1 + r.nextInt(10);
total1 = card1 + card2;
total2 = dealer1 + dealer2;
System.out.println("\nYou drew " + card1 + " and " + card2 + ".");
System.out.println("Your total is " + total1 + ".");
System.out.println("\nThe dealer has " + dealer1 + " and " + dealer2 + ".");
System.out.println("Dealer's total is " + total2 + ".");
System.out.println(" ");
if (total1 >= total2)
System.out.println("YOU WIN!");
else
System.out.println("YOU LOSE!");
}
}
Picture of the output