Write a program to play a game of craps

Assignment Help JAVA Programming
Reference no: EM13698825

Program: Write a program to play a game of "craps," a dice game popular in casinos. Here are the rules:

A player rolls two dice. Each die has six faces. These faces contain 1, 2, 3, 4, 5, and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. If the sum is 7 or 11 on the first throw, the player wins. If the sum is 2, 3, or 12 on the first throw (called "craps"), the player loses (the "house" wins). If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, then that sum becomes the player's "point."

To win, you must continue rolling the dice until you "make your point." The player loses by rolling a 7 before making the point.

Use functions appropriately. The program should allow the user to play another round.

Set up a betting scheme, letting the user set an opening pot (how much money s/he is willing to lose) and decide how much money to bet on each round. The player may choose to quit with winnings or may play until the opening pot is empty.

Be sure to include comments. The comment should describe the purpose of the program and the data to be entered.

Reference no: EM13698825

Questions Cloud

Prepare a binary to decimal memory game : The computer generates a random sequence of 0s and 1s creating a binary number - prepare a binary to decimal memory game.
What is the time complexity of the better method : Modern object-oriented software makes extensive use of the malloc and free operations. Unfortunately, they are generally quite expensive (in time) and thus efficient routines are important.
Find the smallest positive integer : Find the smallest positive integer whose digits add up to 23. The second smallest positive integer whose digits add up to 23 is 689.
Determines the largest value : Write a program Largest that reads three integers from the user and determines the largest value - Write a program InOrder that reads three integers from the user and prints the three integers in sorted order.
Write a program to play a game of craps : Write a program to play a game of "craps," a dice game popular in casinos. Here are the rules - Use functions appropriately. The program should allow the user to play another round.
Find the initial concentration of the weak acid or base : Question- Find the initial concentration of the weak acid or base in an aqueous solution of pyridine (C5H5N) with a pH of 8.81. Kb=1.80x10^-9. Answer in units of mol/L.
Calculate the molarity of h2c2o4 in xalic acid : Question- Calculate the molarity of H2C2O4 in 0.2 M oxalic acid (H2C2O4) if Ka1= 0.059, Ka2=6.5x10^-5, and Kw=1x10^-14. Answer in units of mol/L.
Store the grades that you read in an arraylist : We expect the file to contain grades represented by integer values, one per line. If you encounter a value that is not an integer, you should throw an exception, print a message to the console, skip that value, and continue processing.
A reaction is second order with respect to a : Question- A reaction is second order with respect to [A] and first order with respect to [B]. If the [A] is decreased by a factor of 3 while [B] remains constant, by what factor will the rate change

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create web application uses visual web java server

Create the Web application which uses Visual Web Java Server Faces framework and either Apache Tomcat or Glassfish as the server.

  Create a secure parts inventory catalog system

You will create a secure Parts Inventory Catalog system using Model 2 architecture. The application will require a user to have the proper access right to enter the system, and when satisfied, presents the catalog of items currently available in t..

  Displays every perfect number from 1 through 1000

Write an application that displays every perfect number from 1 through 1000. A perfect number is one that equals the sum of all the numbers that divide evenly into it.

  Add event handling to the button find out the value the

make a windows program in java that has a labeled text field for the price of a meal. there are different discounts for

  Write down an applet which displays a 4x4 grid when the

write an applet that displays a 4x4 grid. when the user clicks on a square in the grid the applet should draw a filled

  Design and implement a set of classes and interfaces and

design and implement a set of classes and interfaces and use them to evaluate the rtas resource requirements.nbspyour

  Java program that prompts the user to input an integer

Write a Java program that prompts the user to input an integer and then outputs both the individual digits of the number and the sum of the digits.

  You are to implement an intrusion detection system in java

you are to implement an intrusion detection system in java. we are assuming all activities are associated with the same

  Program that counts the number of occurrences of lowercase

Write a program that counts the number of occurrences of lowercase and uppercase vowels in entered lines of text. Use a two-dimensional array to store the vowel counts. The array's first column holds the counts for the lowercase vowels, and the secon..

  Assume an ideal gas mixture is in contact with water

Assume an ideal gas mixture is in contact with water. Determine the equilibrium concentration of the contaminant in the liquid is the gas stream is composed of 200 ppm of benzene in air

  In light of wrestling with ethics

In light of "Wrestling With Ethics" and other research/articles that you are able to draw upon, should profitability drive social responsibility? Be sure to support your discussion question responses with evidence from the readings and/or additional ..

  Method that accepts a string object

Word Counter Write a method that accepts a String object as an argument and returns the number of words it contains. For instance, if the argument is "Four score and seven years ago" the method should return the number

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