use methods to calculate the probabilty of wining of rolling two dices
Calculate the probability of winning a pass bet in craps. Here are the rule for a pass bet. Roll two 6-sided dice, and let x be their sum.
if x is 7 or 11, you win instantly
if x is 2, 3, or 12, you lose instantly
otherwise, repeatedly roll two dice until their sum is either x or 7
if their sum is x, you win
if their sum is 7, you lose
Program dice.java takes user's input for N and simulates N pass bets. The program has two methods: sumOfTwoDice and winsPassBet. Both methods have one interesting feature - they do not take any input arguments. The first method simulate the throw of two dice. This returns an integer between 2 and 12, but not all values are equally likely. To simulate the probabilities correctly, we call random(6) twice and one to generate a number between 1 and 6. Then, we add the two values. The second method returns a boolean value: true if we win the pass bet and false otherwise. This method has several return statements. As soon as the first one is executed, the method terminates with the given return value.
The layout of your program is as shown below: