Assignemnt #57: Rolling dice as a Number Generator
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: Dice Game
/// File Name: DiceGame.java
/// Date Finished: 11/13/2015
import java.util.Random;
public class DiceGame
{
public static void main( String[] args )
{
Random r = new Random();
int x = 1 + r.nextInt(6);
int y = 1 + r.nextInt(6);
System.out.println( "Time to roll some dice today. " );
System.out.println();
System.out.println( " Roll #1: " + x );
System.out.println( " Roll #2: " + y );
System.out.println( "The total is " + (x+y) );
}
}
Picture of the output