Assignemnt #71 and Shorter Double Dice
Code
/// Name: Brian Phillips
/// Period: 5
/// Program name: Shorter Double Dice
/// File Name: DiceDoubles2.java
/// Date Finished: 01/15/2016
import java.util.Random;
public class DiceDoubles2
{
public static void main(String[] args)
{
Random r = new Random();
int roll1;
int roll2;
int total;
do
{
roll1 = 1 + r.nextInt(6);
roll2 = 1 + r.nextInt(6);
System.out.println( "Roll #1: " + roll1);
System.out.println( "Roll #2: " + roll2);
total = roll1 + roll2;
System.out.println("The total is " + total + "!");
System.out.println();
}
while (roll1 != roll2);
}
}
Picture of the output