Assignment # 62 and Dice Doubles
Code
/// Name: Tommy Oyuntseren
/// Period: 7
/// Program Name: DiceDoubles
/// File Name: DiceDoubles.java
/// Date: 12/14/2015
import java.util.Scanner;
import java.util.Random;
public class DiceDoubles
{
public static void main(String[] args)
{
Random r = new Random();
byte roll1 = 0;
byte roll2 = 0;
do {
roll1 = (byte) (1 + r.nextInt(6));
roll2 = (byte) (1 + r.nextInt(6));
System.out.println();
System.out.println("Roll the dice!!!");
System.out.println();
System.out.println("Roll#1 " + roll1);
System.out.println();
System.out.println("Roll#2 " + roll2);
System.out.println();
System.out.println("Total is " + (roll2 + roll1));
System.out.println();
}
while (roll1!=roll2);
}
}
Picture of the output