Write a java program that plays the game of craps

Assignment Help JAVA Programming
Reference no: EM13940867

In the game of Craps, a "Pass Line" bet proceeds as follows. Using two six-sided dice, the first roll of the dice in a craps round is called the "Come Out Roll". The bet immediately wins when the come out roll is 7 or 11, and loses when the come out roll is 2, 3, or 12. If 4, 5, 6, 8, 9, or 10 is rolled on the come out roll, that number becomes "the point". The player keeps rolling the dice until either 7 or the point is rolled. If the point is rolled first, then the player wins the bet. If the player rolls a 7 first, then the player loses.

Write a Java program that plays the game of Craps using the rules stated above so that it simulates a game without human input. Instead of asking for a wager, the program should just calculate if 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 plays 10,000 games. Add counters that count how many times the player wins, and how many times the player loses. At the end of the 10,000 games, compute the probability of winning, i.e. Wins / (Wins + Losses) and output this value. Over the long run, who is going to win the most games of Craps, you or the house?

Reference no: EM13940867

Questions Cloud

Business and globalization : Imagination is more important than knowledge (Albert Einstein) We need to think more seriously than ever about how we encourage people to focus on productive outcomes that advance and unite civilization-peaceful imaginations
Markets and of segmenting particular markets : Analyse methods of determining the size and structure of markets and of segmenting particular markets.
Features characteristics and benefits : Select an appropriate organization company for context and reference Conceive a new product or service and determine its features characteristics and benefits Identify and select an appropriate target market
Determine the shortest distance between the two trains : When train A is 6 km south of the crossing bridge, train B is 8 km east. Determine the shortest distance between the two trains and the time from these initial positions that they take to reach it.
Write a java program that plays the game of craps : Write a Java program that plays the game of Craps using the rules stated above so that it simulates a game without human input
Closest distance between the two ships : Determine the velocity of B relative to A, (b) the closest distance between the two ships and (c) the time taken to reach this position.
How does irish police department structure differ from fbi : How does the Irish Police Department structure differ from the FBI? What are the chances of change and efficient adaptability with these types of organizational design?
A manufacturing company produces and sells : A manufacturing company produces and sells 40,000 units of a single product. Variable costs total $80,000 and fixed costs total $120,000. If unit is sold for $8, what markup percentage is the company using?
Nailpolish inventory in java : In addition, the GUI should include a button that allows the user to move to the first item, the previous item, the next item, and the the last item in the inventory

Reviews

Write a Review

JAVA Programming Questions & Answers

  T an array using insertion sort and track the number of swap

How to sort an array using insertion sort and track teh number of swaps during the sorting

  Using a linked implementation of graph write a method

Write a method that takes two nodes as input and returns true if joining an edge between these two nodes, forms a duplicate path to one of the input nodes within the graph.

  You need to find out the average score how many scores are

suppose that you have an array of baseball scores type integer called scores. the values in the array are ordered from

  Write a piece of code that prints the values

Write a piece of code that prints the values requested in each part, given these variables:

  Program to calculate semester grade based on the scores

Write a java application program that takes in user input from keyboard and calculate semester grade based on the scores. I need help, to rewrite the program, instead of taking keyboard input, you will use dialog box to prompt user, take input, an..

  Create four classes

Create four classes: Account.java, Checking.java, Savings.java, and AccountArray.java.

  Write a method for computing tax

Financial application: print a tax table- gives a program to compute tax. Write a method for computing tax using the following header

  Class should have a method that returns the average

Write a class named TestScores. The class constructor should accept an array of test scores as its arguments. The class should have a method that returns the average of the test scores.

  Java graphics-write an application that extends jframe and

java graphics-write an application that extends jframe and that displays a phrase in every font size from 6 through

  Write a main method that reads in a single string

Write a main method that reads in a single string and calls trianglePrint with that string. Write a method that uses recursion to print an input string in the shape of a triangle

  Design and implement a java program to determine the sum

Design and implement a Java program that will gather a group of floating point numbers and determine the sum and average of the data entered. The program should use separate methods for inputting the data, calculating the sum, calculating the aver..

  Write a method named validate to help a local banker

write a method named validate to help a local banker. Your method will need to utilize two input parameters and the method's return value (for its output).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd