Assignment #62 and Dice Doubles
Code
/// Name: Tim Chuang
/// Period: 7
/// Program Name: Dice Doubles
/// File Name: DiceDoubles.java
/// Date Finished: 12/15/2015
import java.util.Random;
public class DiceDoubles
{
public static void main ( String[] args )
{
Random r = new Random();
System.out.println("Lol ready?");
int diceOne = 1 + r.nextInt(6);
int diceTwo = 1 + r.nextInt(6);
int total = diceOne + diceTwo;
System.out.println();
System.out.println("First roll: " + diceOne + ".");
System.out.println("Second roll: " + diceTwo + ".");
System.out.println("Total: " + total + ".");
while ( diceOne != diceTwo )
{
diceOne = 1 + r.nextInt(6);
diceTwo = 1 + r.nextInt(6);
System.out.println();
System.out.println(" First Roll: " + diceOne + ".");
System.out.println(" Second Roll: " + diceTwo + ".");
System.out.println(" Total: " + total + ".");
}
System.out.println(" The total is " + total + ".");
}
}
Picture of the output