Assignment #57
Code
/// Name: Jonathan Stine
/// Period: 5
/// Program Name: Dice
/// File Name: Dice.java
/// Date Finished: 1/19/16
import java.util.Random;
public class Dice {
public static void main( String[] args ) {
Random r = new Random();
int r1, r2, total;
System.out.println( "Dice time." );
System.out.println();
r1 = 1 + r.nextInt(6);
r2 = 2 + r.nextInt(6);
total = r1 + r2;
System.out.println( "Roll #1: " + r1 );
System.out.println( "Roll #2: " + r2 );
System.out.println( "Your total is " + total + "!" );
}
}
Code Output