CS112: In-class Exercise 6 1. We will continue with the rolling-dice project. By now, you should have working classes Die and Dice in the project. 2. Click on New Class . Give the new class the name of CrapsGame . 3. This new class will make objects that play a game of Craps. Now edit the source file. Get rid of all the junk that comes by default with the source file . 4. Fields: Declare one instance variable which is a Dice object. 5. Constructors: The constructor should make a new instance of any field that is an object. 6. methods: Write and test the following method : beginGame() No return value. This method should roll the dice (by calling a method on the Dice object). Report the rolls and the sum to the terminal window. (Again by using calls on the Dice object.) If the sum is 2, 3, or 12 then print to terminal window a message that says you lose. If the sum is 7 or 11 then print to terminal window a message that says you win. Otherwise, print a message that says the game will be
This is the end of the preview. Sign up
access the rest of the document.