use file Craps.java
Write a complete Java program that plays a simplified version of the casino game “Craps.” This game is played with a set of two perfectly balanced dice, each one a cube that has one side containing 1, 2, 3, 4, 5, or 6 black dots.
Your program will “roll” two dice until the total value is 4, 5, 6, 8, 9, or 10. This number becomes the player’s “point.”
After the point value has been obtained, the program continues to roll the dice until the total value of the dice is either:
•7 (in which case you lose), or
• it’s the “point” that was previously established (in which case you win).
You should use the following method that was defined in lecture:
static int rint (int a, int b) {
return a + (int) ( (b-a+1) * Math.random() );
}
You must define a method
static int doRoll() { ... }
that rolls *two* dice and returns the sum of the roll. You may not use any static class variables
It is recommended that you use two separate while or do-while loops to implement this game. Here’s what the program might look like in action:
% java Craps
Computer rolls a 6 and a 5, for a total of 11.
Computer rolls a 1 and a 2, for a total of 3.
Computer rolls a 5 and a 1, for a total of 6.
6 is now the established POINT.
Computer rolls a 4 and a 4, for a total of 8.
Computer rolls a 2 and a 5, for a total of 7.
You Lose
Attachments
No attachments uploaded
Tags
Clarifications
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'cramshark'; // required: replace example with your forum shortname
var disqus_identifier = '/production/1603';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
Please enable JavaScript to view the comments powered by Disqus.

The solution is implemented based in the given requirements.
Attachments

Craps.java (1 K)
Preview

Screen Shot 2016-11-11 at 17.07.00.png (65 K) Preview

Screenshots
- a + 1) * Math.random());
}
/**
* Checks if a number is valid.
*
* @param number
* The given number to be checked.
* @return <code>True</code> if is a valid number, <code>False</code>
* otherwise.
*/
static boolean isValidNumber(int number) {
return (number == 4 || number

Screen Shot 2016-11-11 at 17.07.00.png (65 K) Preview