Assignemnt #62 and Double Dice Rolls
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Double Dice Rolls
///File Name: DoubleDiceRolls
///Date Finished: 11/19/15
import java.util.Random;
public class DoubleDiceRolls
{
public static void main( String[] args )
{
Random r = new Random();
int rollOne = 1 + r.nextInt(6);
int rollTwo = 1 + r.nextInt(6);
int total = rollOne + rollTwo;
System.out.println( "HERE COMES THE DICE!" );
System.out.println( "" );
System.out.println( "Roll #1: " + rollOne );
System.out.println( "Roll #2: " + rollTwo );
System.out.println( "The total is " + total + "!" );
while (rollOne != rollTwo)
{
System.out.println( "" );
rollOne = 1 + r.nextInt(6);
System.out.println( "Roll #1: " + rollOne );
rollTwo = 1 + r.nextInt(6);
System.out.println( "Roll #2: " + rollTwo );
total = rollOne + rollTwo;
System.out.println( "The total is " + total + "!" );
}
}
}
Picture of the output