Assignemnt #57
Code
/// Name: Daniel Nguyen
/// Period: 6
/// Program Name: Dice Program
/// File Name: Dice.java
/// Date Finished: 9/9/2015
import java.util.Random;
import java.util.Scanner;
public class Dice
{
public static void main ( String[] args )
{
Scanner keyboard = new Scanner(System.in);
Random r = new Random();
int sum;
int roll1 = 1 + r.nextInt(6);
int roll2 = 1 + r.nextInt(6);
System.out.println("HERE COMES THE DICE!!!");
System.out.println("");
System.out.println("Roll #1: " + roll1);
System.out.println("Roll #2: " + roll2);
sum = roll1 + roll2;
System.out.println("");
System.out.println("The total is " + sum + "!");
}
}
Picture of the output