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

  Write a script that simulates a casino machine

Write a script that simulates a casino machine. To play a single round on the machine user pays $ 5. Now when the user start the machine, the machine rolls a pair of dice

  Implement a class person with two fields name

Implement a class Person with two fields name and age, and a class Car with three fields - implement a class that saves the details of the person.

  Echo client-server application

ASSIGNMENT 1- An echo client-server application, You are required to develop an application that allows clients running on MS Windows platforms to send sequences of strings to an echo server running on a windows platform

  Program that allows the user to enter an unknown number

Writer a program that allows the user to enter an unknown number of characters, stores those characters in a data structure (a vector) and then prints the values to the screen.

  Write java programming to show number of credits for course

Write the java programming to solve following problem. We are given a student's marks in Calculus 1, CS1, and Physics 1 (each mark being between 0 and 100) also number of credits for each course.

  Prepare a main method that tests all of your functions

A method that outputs the name and list of all patients - A method that resets the number of patients to 0 and the patientList to an empty list - Prepare a main method that tests (i.e, unit testing) all of your functions.

  One search function

One search function will use a sentinel to mark the end of the array. The other search function will use an array length (maximum legal index into the array) to determine when to exit the search loop. Both functions must return true when the searc..

  Give an implementation of the queue adt using an array

Give an implementation of the Deque ADT using an array, so that each of the update methods run in O(1) time. Program has to be written in Java.

  Implement the basic properties of a bank account

Define the class bankAccount to implement the basic properties of a bank account. An object of this class should store the subsequent data:

  Create and code a program that uses three parallel numeric

Create and code a program that uses three parallel numeric arrays of size 6. The program searches one of the arrays and then displays the corresponding values from the other two arrays.

  The class overloaded constructor receives a 2-dim int array

The class overloaded constructor receives a 2-dim int array as a parameter and assigns its values to a private 2-dim int array. Have another method that prints the whole 2-dim table.

  Write a method for the purse class

Write a method for the Purse class public boolean sameContents(Purse other) that checks whether the other purse has the same coins in the same order.

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