Assignment #62 Dice Doubles
Code
/// Name: Koosha Kimelman
/// Period: 7
/// Program Name: Dice Doubles
/// File Name: DiceDoubles.java
/// Date Completed: 11/9/15
import java.util.Random;
public class DiceDoubles {
public static void main(String[] args) {
Random r = new Random();
int r1, r2;
r1 = (1+r.nextInt(6));
r2 = (1+r.nextInt(6));
System.out.println("Here are the dice rolls.");
System.out.println("\nRoll #1: " + r1);
System.out.println("Roll #2: " + r2);
System.out.println("The total is " + (r1+r2) + ".");
while (r1 != r2) {
r1 = (1+r.nextInt(6));
r2 = (1+r.nextInt(6));
System.out.println("\nRoll #1: " + r1);
System.out.println("Roll #2: " + r2);
System.out.println("The total is " + (r1+r2) + ".");
}
}
}
Picture of the output