Assignment #57
Code
///jack newsom
///period 5
///program Dice
///filename Dice.java
///date completed 10/6/15
import java.util.Random;
public class Dice
{
public static void main( String[] args )
{
Random r = new Random();
System.out.println("Here come the dice!");
int num1 = 1 + r.nextInt(5);
int num2 = 1 + r.nextInt(5);
int sum = num1 + num2;
System.out.println("");
System.out.println("Roll #1: " + num1);
System.out.println("Roll #2: " + num2);
System.out.println("The total is " + sum + "!");
}
}
Picture of the output