Assignment #71

Code

    ///Name: Cody Swain
    ///Period: 6
    ///Project Name: DiceDoubles
    ///File Name: DiceDoubles.java
    ///Date: 12/7/15
    
    import java.util.Random;
    import java.util.Scanner;
        
    public class ShorterDiceDoubles
    {
        public static void main ( String[] args ) 
        {
            Random r = new Random();
            Scanner keyboard = new Scanner(System.in);
            int x1, x2; 
            
            System.out.println( "HERE COMES THE DICE! ");
            
            do
            {
            System.out.println();
            x1 = 1 + r.nextInt(6);
            x2 = 1 + r.nextInt(6);
            System.out.println( " Roll #1: " + x1 );
            System.out.println( " Roll #2: " + x2 );
            System.out.println( "The total is " + (x1 + x2) + "!" );
            } while ( x1 != x2 );
                
        }
    }
                
                
        
    

Picture of the output

Assignment 71