Assignment #62 Dice Doubles
Code
///Name: Ian Grant
///Period:5
///Project Name: Dice Doubles
///File Name:DiceDoubles.java
///11/10/15
import java.util.Random;
public class DiceDoubles
{
public static void main(String[] args)
{
Random r = new Random();
int d1,d2;
d1=1+r.nextInt(6);
d2=1+r.nextInt(6);
while (d1 != d2)
{
d1=1+r.nextInt(6);
d2=1+r.nextInt(6);
System.out.println("Here comes the dice!");
System.out.println("Roll #1: "+d1);
System.out.println("Roll #2: "+d2);
System.out.println("The sum is "+(d1+d2));
}
}
}
Output