CS112: In-class Exercise 7 1. We will continue with the rolling-dice project. By now, you should have working classes Die and Dice and CrapsGame in the project. Currently, a player can click beginGame() even if a game is in progress, or choose continueGame() even if a game is over. The following modifications will make it so that a player doesn’t have to remember whether a game is in progress. . 2. Modify the CrapsGame class again. This time, the player should be able to just call a single method rollTheDice() and the program should know whether or not to begin a new game or to continue the game. Use a boolean instance variable so you know whether you are in the middle of a game; this boolean variable should be initialized to false in the constructor. Compile and test after each modification. a. Fields: Add a new instance variable of type boolean . Give it a name such as gameInProgress . Remember, a boolean type variable can have a value of true or false .
This is the end of the preview.
access the rest of the document.