Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The initial given amount of money is $500. (Program in Java) In the game of craps, a passline bet proceeds as follows Two six-sided dice

The initial given amount of money is $500. (Program in Java) image text in transcribed
In the game of craps, a passline bet proceeds as follows Two six-sided dice are rolled, the first roll of the dice in a craps round is called the "come out roll . A come out roll of 7 or 11 automatically wins, with double winnings . A come out roll of 2, 3, or 12 automatically loses . If4, 5,6,8, 9, or 10 is rolled on the come out roll, that number becomes the point The player keeps rolling the dice unil either 7 or the point is rolled If the point is rolled first, then the player wins the bet with even money If a 7 is rolled first, then the player loses Write a program that simulates a game of craps using these rules The player starts out with a given amount of money The program asks the player for a wager, and then calculates whether the player would win or lose The program should simulate rolling the two dice and calculate the sum Add a loop so that the program keeps playing until either (1) the player decides to quit and "cash in", or (2) the player runs out of money . Add counters that count how many times the player wins, and how many times the player loses At the end of the game, compute the probability of winning [ie, wins (wins Losses)] and output this value to the user as well Notes Your program must implement and use calls to the following methods static int rol1Dice) Simulates rolling a pair of dice, returns an integer in the range (2,.. 12) static boolean rollwithPoint (int point) Simulates rolling the dice until either the player wins (true is returned) or loses (false is returned)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions