Programming Assignment #71
Code
/// Name: Dylan Sleeper
/// Period: 6
/// Program Name: Dice
/// File Name: Dice.java
/// Date Finished: 1/5/2016
import java.util.Random;
public class Dice{
public static void main(String[] args){
Random r = new Random();
int roll1, roll2;
do{
roll1 = r.nextInt(6) + 1;
roll2 = r.nextInt(6) + 1;
System.out.println("Roll#1: " + roll1);
System.out.println("Roll#2: " + roll2);
System.out.println("Total: " + (roll1 + roll2));
System.out.println();
} while(roll1 != roll2);
}
}
Outputs