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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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