Assignemnt #89 Baby Blackjack
Code
import java.util.Random;
public class Baby
{
public static void main( String[] args )
{
Random r = new Random();
int p1=r.nextInt(6), p2=r.nextInt(6),d1=r.nextInt(6),d2=r.nextInt(6),pt,dt;
pt=p1+p2;
dt=d1+d2;
System.out.println("You drew "+p2+" and "+p2+".");
System.out.println("Your total is "+pt+".");
System.out.println();
System.out.println("The dealer drew "+d2+" and "+d2+".");
System.out.println("Dealer's total is "+dt+".");
if(pt<21 && dt<22)
{
if(pt>dt)
System.out.println("You win");
else(pt>dt)
System.out.println("You lose");
}
else if (pt>21)
System.out.println("You lose");
else
System.out.println("You win");
}
}
Picture of the output