Write a simple dice game

Assignment Help Computer Engineering
Reference no: EM133695009

The program:

You will write a simple dice game. The game starts by giving the player $250. The game prompts the player for the amount they want to bet and the sum of two randomly rolled die. If the player guess the sum correctly, the player wins some money based on the rules below. If the player guesses wrong, the player loses the amount that was bet. The game repeats until either the player runs out of money or the player chooses to stop playing.

Here are the rules for winning and losing.

If the guess matches the sum of the die and the two die have the same value, the winning is four times the bet. For example, if the player bet $100 and the player guesses four as the sum and first dice is two and second dice is two, then the player is awarded $400, which is twice the bet of $100.
If the guess matches the sum of the dice but the two die have different values, then the winning amount is the same as the bet.
If the player guesses the sum incorrectly, he loses the amount equal to the bet.

Input validation:

Make sure the player does not bet more than they have or a negative amount. If the amount is negative or greater than the amount they have, ask the player to reenter the bet.
Make sure the player types Y, y, N or n when prompted to continue the game. If the player enters anything else, the game should ask the player to reenter the answer.

Reference no: EM133695009

Questions Cloud

Monitoring blood sugars : She also wants to know how often she should be monitoring her blood sugars. what are risk for tight glycemic control
Describe the fundamental requirements in scaling agile : Describe the fundamental requirements in scaling agile methods to integrate with plan-driven methods. Describe the concepts of user and systems requirements
Benefits of stimulant medications for the treatment of add : Benefits of stimulant medications for the treatment of ADD. What are some of the concerns associated with using these drugs for the treatment of children?
What type of structure can securely store cat iii : What type of structure can securely store CAT III and IV ammunition and explosives items? AGMs only, ECMs only, Open storage site, ACMs, ECMs, or portable
Write a simple dice game : Write a simple dice game. The game starts by giving the player $250. The game prompts the player for the amount they want to bet and the sum of two randomly
What is the history of the health policy issue : What is the history of the health policy issue? Why is this an important issue in U.S. health policy?
Can you describe your methodology : Can you describe your methodology for ensuring that your database designs are scalable and optimized?
Explain support workers responsibility to report allegation : Explain support workers' responsibility to report allegations or suspicions of abuse and neglect according to legislative requirements.
What is the data type of the attribute that stores : Attributes of relations have data types associated with them. What is the data type of the attribute that stores the geometry of a feature class

Reviews

Write a Review

Computer Engineering Questions & Answers

  Summarize all the data visualization techniques

Summarize all the data visualization techniques (and its applications) in R. Please use the textbook and other resources. A minimum of three references.

  Display an integer in its binary format

Write a function and name it conversion to display an integer in its binary format.

  Write a program use a matrix represent

Write a Program Use a matrix represent.

  What are the types of cryptography or encryption

Select one type of cryptography or encryption and explain it in detail. Include the benefits as well as the limitations of this type of encryption.

  Compute the surface area and volume of a sphere

Write a main program that uses these functions to compute the surface area and volume of a sphere given the radius.

  Create both pseudocode and a flowchart

Create both pseudocode and a flowchart to design a program that creates a Car object and then calls the accelerate method five times

  Prove the seventh design criterion for p-boxes by checking

Prove the seventh design criterion for P-boxes by checking the relationship between S-box 5 in round 4 and S-box 7 in round 5.

  Describe guiding principles of software to be ready for

Describe guiding principles of software to be ready for release from a security viewpoint Specify requirements for Salus Cybsec's software acceptance process

  Identify and analyze what you believe to be the most

write a four to five 4-5 page paper in which youidentify and analyze what you believe to be the most significant new

  What is the output of the statements

What is the output of the following statements. assume a and b are int variables.

  Explain the quality assurance categories

Compile a list of 5-7 quality assurance categories, and discuss how they will be evaluated in the integration project.

  What is the syntax of the while construct

What is the syntax of the "while" construct in the c programming language?

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