PROGRAMMING AND CODE
Assignemnt #62
Code
/// Name: Justin Li
/// Period 7
/// Program Name: DiceDoubles
/// File Name: DiceDoublesf.java
/// Date Finished: 9/23/15
import java.util.Scanner;
import java.util.Random;
class DiceDoubles {
public static void main(String[]args) {
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int one, two, total;
one = 1 + r.nextInt(6);
two = 1 + r.nextInt(6);
total = one + two;
while(one != two)
{
System.out.println("Roll #1: " + one);
System.out.println("Roll #2: " + two);
System.out.println("\nThe total is " + total);
one = 1 + r.nextInt(6);
two = 1 + r.nextInt(6);
total = one + two;
}
System.out.println("Roll #1: " + one);
System.out.println("Roll #2: " + two);
System.out.println("\nThe total is " + total);
}
}