Assignment #62 Dice Doubles
Code
/// Name: John Huh
/// Period: 6
/// Program Name: Dice Doubles
/// File Name: DoubleDice.java
/// Date Finished: 12/9/2015
import java.util.Random;
public class DoubleDice
{
public static void main( String[] args )
{
Random r = new Random();
int roll1, roll2, total;
roll1 = 1 + r.nextInt(6);
roll2 = 1 + r.nextInt(6);
total = ( roll1 + roll2 );
System.out.println();
System.out.println( "HERE COMES THE DICE!" );
System.out.println();
while ( roll1 != roll2 )
{
roll1 = 1 + r.nextInt(6);
roll2 = 1 + r.nextInt(6);
total = ( roll1 + roll2 );
System.out.println( "Roll #1: " + roll1 );
System.out.println( "Roll #2: " + roll2 );
System.out.println( "The total is " + total + "!" );
System.out.println();
}
}
}
Picture of the output