Assignment 62 and Double
Code
///Matthew Hughs
///Period 5
///Double
///Double.java
///12/16/2015
import java.util.Random;
class Double
{
public static void main (String [] args)
{
Random r = new Random();
System.out.println("The dice are coming!!!!");
int x , y ;
x = (1 + r.nextInt(6));
y = (1 + r.nextInt(6));
System.out.println("Roll 1: " + x);
System.out.println("Roll 2: " + y);
System.out.println("The total is " + (x + y));
while ( x != y )
{
x = (1 + r.nextInt(6));
y = (1 + r.nextInt(6));
System.out.println("Roll 1: " + x);
System.out.println("Roll 2: " + y);
System.out.println("The total is " + (x + y));
}
}
}
Picture of the output