import cs1.Keyboard; /** Simulate rolling two dice n times. @author Greg Vogl last modified 2003-09-30 */ public class DieTest { /** Test the Die class. */ public static void main (String[] args) { // get input System.out.println("This program simulates rolling two dice."); System.out.println("Enter the number of times to roll the dice and press Enter."); int n = Keyboard.readInt(); // create two dice Die die1 = new Die(); Die die2 = new Die(); // roll the dice n times for (int i = 0; i < n; i++) { die1.roll(); die2.roll(); int sum = die1.getFace() + die2.getFace(); System.out.println("Trial\t" + (i+1) + "\tResult\t" + sum); } } }