Assignment #62 Double Dice
Code
/// Name: DeeJay Cerezo
/// Period: 7
/// Program Name: Double Dice
/// File Name: Double.java
/// Date Finished: 12/7/2015
import java.util.Random;
public class Double
{
public static void main ( String[] args )
{
Random r = new Random();
System.out.println("Here's your dice!");
int diceOne = 1 + r.nextInt(6);
int diceTwo = 1 + r.nextInt(6);
int total = diceOne + diceTwo;
System.out.println();
System.out.println("Roll #1: " + diceOne + ".");
System.out.println("Roll #2: " + diceTwo + ".");
System.out.println("Total: " + total + ".");
while ( diceOne != diceTwo )
{
diceOne = 1 + r.nextInt(6);
diceTwo = 1 + r.nextInt(6);
System.out.println();
System.out.println("Roll #1: " + diceOne + ".");
System.out.println("Roll #2: " + diceTwo + ".");
System.out.println("Total: " + total + ".");
}
System.out.println("The total is " + total + ".");
}
}
Picture of the output