Programming Assignment #62

Code

/// Name: Dylan Sleeper
/// Period: 6
/// Program Name: Monte
/// File Name: DiceRoll.java
/// Date Finished: 1/4/2016

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

import java.util.Random;

public class DiceRoll{

    public static void main(String[] args){
        
        Random r = new Random();
        boolean goOn = false;
        System.out.println("");
        
        while(goOn == false){
            int roll1 = r.nextInt(6) + 1;
            int roll2 = r.nextInt(6) + 1;
            
            System.out.println("Roll #1: " + roll1);
            System.out.println("Roll #2: " + roll2);
            System.out.println("The total is " + (roll1 + roll2) + "!");
            System.out.println("");
            
            if(roll1 == roll2){
                goOn = true;
            }
        }
    
    }

}

  

Outputs

Assignment 15