Assignment #71 and ShorterDoubleDice
Code
/// Name: Jason Kim
/// Period: 7
/// Program Name: ShorterDoubleDice
/// File Name: ShorterDoubleDice.java
/// Date Finished:11/12/15
import java.util.Random;
public class ShorterDoubleDice
{
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!");
do
{
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) + "!");
}while( firstRoll != secondRoll);
}
}
Picture of the output