Assignemnt 71 and ShorterDoubleDice

Code

    /// Name: Xinting Chen
    /// Period: 7
    /// Program Name: Shorter Double Dice
    /// File Name: ShorterDoubleDice.java
    /// Date Finished: 12/14/2015
  
    
import java.util.Random;
    
public class ShorterDoubleDice
{
    public static void main(String[] args)
    {
            
        Random r = new Random();
            
        int d1, d2;
        double total;
            
        d1 = 1 + r.nextInt(6);
        d2 = 1 + r.nextInt(6);
        total = d1 + d2;
        
        do
        {
            d1 = 1 + r.nextInt(6);
            d2 = 1 + r.nextInt(6);
            total= d1 + d2;
            
            System.out.println( "Roll your dice" );
            System.out.println( "" );
            System.out.println( "Roll 1: " + d1 );
            System.out.println( "Roll 2: " + d2 );
            System.out.println( "Total: " + total );
        }
        while (d1!= d2);
     }
}



    

Picture of the output

Assignment 71