Assignment #62
Code
///jack newsom
///period 5
///program DiceDoubles
///filename DiceDoubles.java
///date completed 10/7/15
import java.util.Random;
public class DiceDoubles
{
public static void main( String[] args)
{
System.out.println("Here come the dice!");
Random r = new Random();
int r1 = 1 + r.nextInt(5);
int r2 = 1 + r.nextInt(5);
while ( r1 != r2 )
{
r1 = 1 + r.nextInt(5);
r2 = 1 + r.nextInt(5);
System.out.println("\tRoll #1: " + r1 );
System.out.println("\tRoll #2: " + r2 );
int total = r1 + r2;
System.out.println("The total is " + total + "!" );
}
}
}
Picture of the output