Assignment #62
Code
///Name: Cody Swain
///Period: 6
///Project Name: DiceDoubles
///File Name: DiceDoubles.java
///Date: 12/1/15
import java.util.Random;
import java.util.Scanner;
public class DiceDoubles
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int x1 = 1 + r.nextInt(6);
int x2 = 1 + r.nextInt(6);
System.out.println( "HERE COMES THE DICE! ");
while ( x1 != x2 ){
System.out.println();
System.out.println( " Roll #1: " + x1 );
System.out.println( " Roll #2: " + x2 );
System.out.println( "The total is " + (x1 + x2) + "!" );
x1 = 1 + r.nextInt(6);
x2 = 1 + r.nextInt(6);
}
System.out.println();
System.out.println( " Roll #1: " + x1 );
System.out.println( " Roll #2: " + x2 );
System.out.println( "The total is " + (x1 + x2) + "!" );
}
}
Picture of the output