Assignment #71
Code
///jack newsom
///period 5
///program DiceP2
///filename DiceP2.java
///date completed 10/13/15
import java.util.Random;
public class DiceP2
{
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);
do
{
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 + "!" );
}while ( r1 != r2 );
}
}
Picture of the output