The Game50 dice game is described in the textbook. Here is the partially written
ID: 3906312 • Letter: T
Question
The Game50 dice game is described in the textbook. Here is the partially written Game50 class. public class Game50{ static final int SIZE = 50; // target score to be exceeded private int bound; // number of allowable rolls to reach 50 private int rollCount; // number of rolls private int total; // accumulated dice roll sum private boolean winner; // game a win or loss? public Game50(int rollBound){ bound = rollBound; // rollBound value supplied in constructor call in driver class } public void playGame(){ initializeGame(); while(!gameOver()){ advancePlay(); showGame(); } judgeAndReport(); } In the answer box below, enter code that implements the code for the Game50 for the private method roll.
Explanation / Answer
private void roll() { total += new Random().nextInt(bound); rollCount++; }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.