Assignment #57 and Dice
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: Dice
/// File Name: Dice.java
/// Date Finished: 12/03/2015/
import java.util.Random;
public class Dice
{
public static void main(String[] args)
{
Random r = new Random();
int roll1, roll2;
double total;
roll1 = 1 + r.nextInt(6);
roll2 = 1 + r.nextInt(6);
total = roll1 + roll2;
System.out.println("WELCOME TO THE WORLD'S BEST DICE GAME EVER!");
System.out.println("");
System.out.println("Roll #1: " + roll1 );
System.out.println("Roll #2: " + roll2 );
System.out.println("The total is " + total + "!");
}
}
Picture of the output