import java.util.Scanner;

/**
 * A program that rolls some dice.  The command to roll the die is in its own
 * method.
 *
 * @author Mark Young (A00000000)
 */
public class ValueReturningMethod {

    public static void main(String[] args) {
        // create variables
        int d1, d2, dice;

        // Introduce yourself
        System.out.println("\n\n"
                + "I'm just rollin' some dice!");
        pause();

        // roll dice
        d1 = rollDie();
        d2 = rollDie();
        dice = d1 + d2;

        // report the result
        System.out.println("I got a " + d1 + " and a " + d2 + ".\n"
                + "The total is " + dice + ".");
        pause();
    }

    /**
     * Simulate rolling a six-sided die.
     *
     * @return a random number in the range 1..6
     */
    private static int rollDie() {
        return 1 + (int)(6 * Math.random());
    }

    /**
     * Prompt the user and wait for them to press the enter key.
     */
    public static void pause() {
        Scanner kbd = new Scanner(System.in);

        System.out.println();
        System.out.print("Press Enter...");
        kbd.nextLine();
        System.out.println();
    }

}
