Assignment #62
Code
///Name: Conner Wygaerts
///Period: 6
///Project Name: DiceDouble
///File Name:DiceDouble.java
///Date Finished: 12/2/15
import java.util.Scanner;
import java.util.Random;
public class DiceDouble
{
public static void main( String[] args )
{
Random r = new Random();
int num1 = 1 + r.nextInt(6);
int num2 = 1 + r.nextInt(6);
System.out.println("Here comes the dice!");
System.out.println("");
System.out.println("Roll 1: " + num1);
System.out.println("Roll 2: " + num2);
System.out.println("");
int total = num1 + num2;
System.out.println("Your total is " + total);
while (num1 != num2)
{
num1 = 1 + r.nextInt(6);
num2 = 1 + r.nextInt(6);
System.out.println("Roll #1: " + num1);
System.out.println("Roll #2: " + num2);
total = num1 + num2;
System.out.println("The total is " + total + "!");
System.out.println();
}
}
}
Picture of the output