/* * Backgammon buddy */ import java.awt.*; class CS5App { public static void main(String[] args) { // we will roll two dice 100 times // to determine how often doubles appears int counter = 0; for (int i=0 ; i<100 ; ++i ) // 100 times { int die1 = H.randInt(1,6); // roll of one die int die2 = H.randInt(1,6); // roll of the other die if (die1 == die2) // if the dice are equal (doubles) { counter++; // we increment our counter by 1 } } // now, we've rolled 100 times // we should print the number of doubles we got H.pl("Out of 100 rolls, " + counter + " of them were doubles.\n\n"); } // end main }