Assignemnt #62

Code

          /// Name: Holden Ganch
          /// Period: 7
          /// Program Name:  sixty second Program
          /// File Name: Dice.java
          /// Date Finished: 12/8/2015


    
        import java.util.Random;
        import java.util.Scanner;
        
        public class Dice
        {
            public static void main( String[] args )
            {
            Random r = new Random();
            Scanner keyboard = new Scanner(System.in);
            int x = 1 + r.nextInt(6), y = 1 + r.nextInt(10), z;
            z = x + y;
            
            System.out.println("YOU NEED DOUBLES!!!");
            System.out.println("Lets say your in jail in monopoly and you need doubles to get out of jail. ");
            System.out.println("You grab the dice and roll them lets see how many tries it takes. ");
            
              while ( x != y )
            {
            x = 1 + r.nextInt(6);
            y = 1 + r.nextInt(6);
                    
              z = x + y;
            System.out.println("Roll #1: " + x);
            System.out.println("Roll #2: " + y);
           
            System.out.println("The total is " + z);
            System.out.println("");
                    }
                }
            }
    
   




    

Picture of the output

Assignment 62