Random Numbers #54 (Only physics tells you the answer)

Code

/// Name: Amir Salehi
/// Period: 7
/// Program Name:Dice
/// File Name: Dice.java
/// Date Finished: 12/2/2015

import java.util.Random;

public class Dice
{
	public static void main ( String[] args )
	{
		Random r = new Random();

		int number2 = 1 + r.nextInt(6);
        int number1 = 1 + r.nextInt(6);

		String response = "";

		System.out.println( "HERE COMES THE DICE! ");
        
        System.out.println("");
        
        System.out.println("Roll #1: " + number2 );
        
        System.out.println("Roll #2: " + number1 );
        
            System.out.println("The total is " + (number1 + number2) + "!");
	}
}
    

Picture(s) of the output

Assignment 7

Back to Homepage