/** * Successively roll 2 6-sided dice, but no more than NUMBEROFCHANCES * times. If, at any time, the player's score is equal to or greater * than WINSCORE, the player wins, otherwise, the player loses. * If you change NUMBEROFCHANCES or WINSCORE, be sure to keep * winning in the range of 50-80% * @author pdakehar * Creation Date - October 2011 */ public class DiceGame { public static final int NUMBEROFCHANCES = 7; public static final int WINSCORE = 47; /** * Generate a random number for the roll of one die with the * number of sides specified. * @param numberOfSides indicates the number of sides on the die * @return the number rolled */ public static int roll(int numberOfSides) { // TODO code application logic here // Generate a random number for the roll of one die } /** * Check if the player won. If so print a positive message and return * true. If not, and the NUMBEROFCHANCES has expired, print a loss * message and return false. (In any other case, the player has not * gotten a high enough score, but has more chances, return false.) * @param name the player's name * @param score the player's current score * @return true if the player won (score>WINSCORE), false otherwise */ public static boolean checkWin( String name, int score, int numberOfTimesRolled) { // TODO code application logic here } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here // Roll dice and print update messages. } }