Assignment #62 and Dice Doubles
Code
/// Name: Ali Kurland
/// Period: 6
/// Program Name: Dice Doubles
/// File Name: DiceDoubles.java
/// Date Finished: 10/9/2015
import java.util.Random;
public class DiceDoubles
{
public static void main (String[] args )
{
Random r = new Random();
int die1 = 1 + r.nextInt(6);
int die2 = 1 + r.nextInt(6);
System.out.println( "HERE COMES THE DICE!\n" );
System.out.println( "Roll #1: " + die1 );
System.out.println( "Roll #2: " + die2 );
System.out.println( "The total is " + ( die1 + die2 ) + "!" );
while ( die1 != die2 )
{
die1 = 1 + r.nextInt(6);
die2 = 1 + r.nextInt(6);
System.out.println( "Roll #1: " + die1 );
System.out.println( "Roll #2: " + die2 );
System.out.println( "The total is " + ( die1 + die2 ) + "!" );
}
}
}
Picture of the output