Assignemnt #71 and Shorter Double Dice Rolls
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Shorter Double Dice Rolls
///File Name: ShorterDoubleDiceRolls
///Date Finished: 12/8/15
import java.util.Random;
public class ShorterDoubleDiceRolls
{
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 + "!" );
do
{
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 + "!" );
}while (rollOne != rollTwo);
}
}
Picture of the output