Assignemnt #63
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: Dice
/// File Name: Dice.java
/// Date Finished: 11/02/2015
import java.util.Random;
import java.util.Scanner;
public class Dice
{
public static void main( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int x = 1 + r.nextInt(6), y = 1 + r.nextInt(10), z;
z = x + y;
System.out.println("Here comes the dice");
while ( x != y )
{
x = 1 + r.nextInt(6);
y = 1 + r.nextInt(6);
z = x + y;
System.out.println("Roll #1: " + x);
System.out.println("Roll #2: " + y);
System.out.println("The total is " + z);
System.out.println("");
}
}
}
Picture of the output