Assignment #71

Code

    /// Name: Mahima Choudhary
    /// Period: 6
    /// Program Name: Shorter Double Dice
    /// File Name: ShorterDiceDoubles.java
    /// Date Finished: =1/5/2015
    
    import java.util.Random;

    public class ShorterDiceDoubles
    {
        public static void main(String[] args)
        {
            Random r = new Random();
    
            System.out.println("HERE COMES THE DICE!");
            System.out.println();
    
            int roll1, roll2;
            do
            {
                roll1 = 1 + r.nextInt(6);
                roll2 = 1 + r.nextInt(6);
    
                System.out.println("Roll #1: " + roll1);
                System.out.println("Roll #2: " + roll2);
    
                int total = roll1 + roll2;
                System.out.println("The total is " + total + "!");
                System.out.println();
                
            } while (roll1 != roll2);
        }
    }
    

Picture of the output

Assignment 71