Assignemnt #89 and Baby Blackjack
Code
/// Name: Kyle Ivy
/// Period: 5
/// Program Name: BabyBlackjack
/// File Name: BabyBlackjack.java
/// Date Finished: 4/20/2016
import java.util.Scanner;
import java.util.Random;
public class BabyBlackjack {
public static void main( String[] args ) {
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int num1 = 1 + r.nextInt(10);
int num2 = 1 + r.nextInt(10);
int num3 = 1 + r.nextInt(10);
int num4 = 1 + r.nextInt(10);
System.out.println( "Baby Blackjack!" );
System.out.println();
System.out.println( "You drew a " + num1 + " and a " + num2 + ". ");
System.out.println( "Your total is " + (num1 + num2) );
System.out.println();
System.out.println( "The dealer has a " + num3 + " and " + num4 + ". " );
System.out.println( "Dealer's total is " + (num3 + num4) );
System.out.println();
if ( (num1+num2) > (num3+num4) ){
System.out.println( "YOU WIN! ");
}
else if ( (num1+num2) < (num3+num4) ){
System.out.println( "YOU LOSE! ");
}
else if ( (num1+num2) == (num3+num4) ){
System.out.println( "TIE! ");
}
}
}
prog89.PNG