Assignemnt #62 and Dice Doubles
Code
/// Name: Raff Lisbona
/// Period: 6
/// Program Name: Dice Doubles
/// File Name: DiceDoubles.java
/// Date Finished: 11/20/2015
import java.util.Random;
public class DiceDoubles
{
public static void main( String[] args )
{
Random r = new Random();
System.out.println("HERE COMES THE DICE!");
System.out.println(" ");
int dice1, dice2, total;
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 )
{
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 + "!");
}
}
}
Picture of the output