Assignemnt #71 Shorter Double Dice
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: Shorter Double Dice
///File Name: DD.java
///Date: 1/17/2016
import java.util.Random;
public class DD
{
public static void main (String[] args)
{
Random r = new Random();
int Dice1, Dice2, total;
Dice1 = 1 + r.nextInt(6);
Dice2 = 1 + r.nextInt(6);
total = Dice1 + Dice2;
System.out.println("HERE COMES THE DICE!");
System.out.println("");
System.out.println("Roll #1: " + Dice1);
System.out.println("Roll #2: " + Dice2);
System.out.println("The total is " + total);
do
{
System.out.println("");
Dice1 = 1 + r.nextInt(6);
Dice2 = 1 + r.nextInt(6);
total = Dice1 + Dice2;
System.out.println("Roll #1: " + Dice1);
System.out.println("Roll #2: " + Dice2);
System.out.println("The total is " + total);
}while(Dice1 != Dice2);
}
}
Picture of the output