Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Ms. Crackenbush\'s resort is expanding into the casino world and she has heard t

ID: 3656709 • Letter: M

Question

Ms. Crackenbush's resort is expanding into the casino world and she has heard that you recently started doing graphical applications in Java. She only likes dice games, though. Create a casino-like graphical dice betting game similar to the game Craps, but simplified, that will: roll two dice at a time return there "name" versus value (see key below) if the first roll is 2, 3, or 12 they lose (deduct bet) if the first roll is 7 or 11 they win (add bet) otherwise the number rolled is their point They then should continue to roll (display) until they either roll their point again (add bet) roll a seven (deduct bet) 2 = snake eyes 3 = trey 4 = four 5 = fiver 6 = six 7 = seven 8 = eight 9 = nine 10 = ten 11 = leven 12 = boxcars

Explanation / Answer

public class DiceGame { static int random(int die1, int die2) { die1 = (int)(Math.random()*6) + 1; die2 = (int)(Math.random()*6) + 1; } public boolean PlayerWins(int diceSum) { return diceSum == 2 || diceSum == 3 || diceSum == 11 || diceSum == 12; } public static void main(String args []) { System.out.println("Would you like to play the game? (y/n) "); String responseLine = Console.readString(); char response = responseLine.charAt(0); if(response == 'y') { int diceSum = random(1, 6) + random(1,6); for(int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote