Assignemnt #71
Code
/// Name: Daniel Nguyen
/// Period: 6
/// Program Name: doubledo Program
/// File Name: doubledo.java
/// Date Finished: 9/9/2015
import java.util.Random;
import java.util.Scanner;
public class doubledo
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
Random rng = new Random();
int roll1, roll2, total;
do {
roll1 = 1 + rng.nextInt(6);
roll2 = 1 + rng.nextInt(6);
total = roll1 + roll2;
System.out.println("Roll #1: " + roll1);
System.out.println("Roll #2: " + roll2);
System.out.println("The total is: " + total);
} while ( roll1 != roll2 );
}
}
Picture of the output