Assignment #71 SHorter Dice
Code
/// Name: DeeJay Cerezo
/// Period: 7
/// Program Name: Shorter Dice
/// File Name: ShortDice.java
/// Date Finished: 1/6/2016
import java.util.Random;
public class ShortDice
{
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 + ".");
do {
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 + ".");
} while ( diceOne != diceTwo );
System.out.println("The total is " + total + ".");
}
}
Picture of the output