Assignment #62 and DiceDoubles
Code
/// Name: Jason Kim
/// Period: 7
/// Program Name: DiceDoubles
/// File Name: DiceDoubles.java
/// Date Finished:11/2/15
import java.util.Random;
public class DiceDoubles
{
public static void main (String[]args)
{
int firstRoll, secondRoll;
Random r = new Random();
firstRoll = 1 + r.nextInt(6);
secondRoll = 1 + r.nextInt(6);
System.out.println("Here comes the dice!");
System.out.println("Roll #1: " + firstRoll );
System.out.println("Roll #2: " + secondRoll );
System.out.println("The total is " + (firstRoll + secondRoll) + "!");
while( firstRoll != secondRoll )
{
System.out.println();
firstRoll = 1 + r.nextInt(6);
secondRoll = 1 + r.nextInt(6);
System.out.println("Roll #1: " + firstRoll );
System.out.println("Roll #2: " + secondRoll );
System.out.println("The total is " + (firstRoll + secondRoll) + "!");
}
}
}
Picture of the output