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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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