Assignemnt #62 and Dice Doubles
Code
/// Name: Kyle Ivy
/// Period: 5
/// Program Name: DiceDoubles
/// File Name: DiceDoubles.java
/// Date Finished: 1/5/2016
import java.util.Random;
import java.util.Scanner;
public class DiceDoubles {
public static void main ( String[] args ) {
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int n1 = 1 + r.nextInt(6);
int n2 = 1 + r.nextInt(6);
System.out.println( "HERE COMES THE DICE! ");
while ( n1 != n2 ){
System.out.println();
System.out.println( " Roll #1: " + n1 );
System.out.println( " Roll #2: " + n2 );
System.out.println( "The total is " + (n1 + n2) + "!" );
n1 = 1 + r.nextInt(6);
n2 = 1 + r.nextInt(6);
}
System.out.println();
System.out.println( " Roll #1: " + n1 );
System.out.println( " Roll #2: " + n2 );
System.out.println( "The total is " + (n1 + n2) + "!" );
}
}
prog62.PNG