Assignment #71 and Shorter Double Dice
Code
/// Name: Ali Kurland
/// Period: 6
/// Program Name: Shorter Double Dice
/// File Name: DoubleDice.java
/// Date Finished: 10/16/2015
import java.util.Random;
public class DoubleDice
{
public static void main( String[] args )
{
Random rng = new Random();
System.out.println( "HERE COME THE DICE!" );
int die1, die2;
do
{
die1 = 1 + rng.nextInt(6);
die2 = 1 + rng.nextInt(6);
System.out.println( "\nRoll #1: " + die1 );
System.out.println( "Roll #2: " + die2 );
System.out.println( "The total is " + ( die1 + die2 ) +"!" );
} while ( die1 != die2 );
}
}
Picture of the output