Assignment #71

Code

 ///Name: Conner Wygaerts
///Period: 6
///Project Name: ShorterDice
///File Name: ShorterDice.java
///Date Finished: 1/6/16

import java.util.Scanner;
import java.util.Random;

public class ShorterDice
{
	public static void main( String[] args )
	{
    		Random r = new Random();
        
        int num1 = 1 + r.nextInt(6);
        int num2 = 1 + r.nextInt(6);
        
        System.out.println("Here comes the dice!");
        System.out.println("");
        
        System.out.println("Roll 1: " + num1);
        System.out.println("Roll 2: " + num2);
        System.out.println("");
        
        int total = num1 + num2;
        
        System.out.println("Your total is " + total);
        
          do while (num1 != num2)
            {
                num1 = 1 + r.nextInt(6);
                num2 = 1 + r.nextInt(6);
                
                System.out.println("Roll #1: " + num1);
                System.out.println("Roll #2: " + num2);
                
                total = num1 + num2;
                System.out.println("The total is " + total + "!");
                System.out.println();
              
         } while (num1 != num2);
    }
    
}

Picture of the output

YourInitials.html