ITEC 120 LAB 7 Back to Lab index page

Rolling Dice

Write a Java program that simulates the rolling of a pair of dice. For each die in the pair, the program should generate a random number between 1 and 6 (inclusive). It should print out the result of the roll for each die and the total roll (the sum of the two dice), all appropriately labeled. You must use the Random class. The RandomNumbers program in listing 3.2 of the text may be helpful.