Assignment #57 Dice
Code
/// Name: Lacey Reese
/// Period: 5
/// Program Name: Dice
/// File Name: Dice.java
/// Date Finished 11/25/2015
import java.util.Random;
public class Dice
{
public static void main( String[] args )
{
Random r = new Random();
int d1, d2, total;
System.out.println( "Here comes the dice! Be prepared!!" );
System.out.println();
d1 = 1 + r.nextInt(6);
d2 = 2 + r.nextInt(6);
total = d1 + d2;
System.out.println( "Roll #1: " + d1 );
System.out.println( "Roll #2: " + d2 );
System.out.println( "Your total is " + total + "!" );
}
}
Picture of the output
//