Assignemnt #67 Shorter Double Dice
Code
/// Name: JJ Deng
/// Period: 6
/// Program Name: Shorter Double Dice
/// File Name: Double Dice.java
/// Date Finished: 1/13/2016
import java.util.Random;
public class ShorterDoubleDice
{
public static void main(String[] args)
{
Random r = new Random();
int d1, d2;
double total;
d1 = 1 + r.nextInt(6);
d2 = 1 + r.nextInt(6);
total = d1 + d2;
do
{
d1 = 1 + r.nextInt(6);
d2 = 1 + r.nextInt(6);
total= d1 + d2;
System.out.println( "Roll your dice" );
System.out.println( "" );
System.out.println( "Roll 1: " + d1 );
System.out.println( "Roll 2: " + d2 );
System.out.println( "Total: " + total );
}
while (d1!= d2);
}
}
Picture of the output