Assignment 62, Dice Doubles
Code
///Name: Stella Koliavas
///Period: 5
///Program Name: Dice2
///File Name: Dice2.java
///Date Finshed: 12/10/15
import java.util.Random;
import java.util.Scanner;
public class Dice2
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner siri = new Scanner(System.in);
int x = 1 + r.nextInt(6);
int y = 1 + r.nextInt(6);
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) );
System.out.println( " ");
}
}
}
Picture of the output