Question: Create a die class. It has value 1,2,3,4,5, or 6. You will need a method (call it getFace ) which returns the face value of
Create a die class. It has value 1,2,3,4,5, or 6. You will need a method (call it getFace ) which returns the face value of the die.
Altogether you will have one attribute (face), and the following methods: constructor (calls roll), roll, getFace.
Test it by writing a main method in which you roll 2 dice. If you get exactly 7 you win, 11 you lose, anything else roll both dice again until you either win or lose. in order to verify your program works correctly put a println in the loop so that every time you roll the dice you print out the total value.
In the beginning please have comments to state what the program does.
Comments within the program.
A correct constructor for die class (returns random # between 1 and 6).
A correct roll method within the die class.
A correct method getFace in die class.
A correct use of class methods in Main.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
