Investigate the use of the random generator function

Assignment Help C/C++ Programming
Reference no: EM13813187

For this assignment you will have to investigate the use of the C++ random generator function, rand(). Rand() produces a random integer in the range of 0 to RAND_MAX (a constant -- often 32767 -- defined in the stdlib, automatically included in all of your projects). You can find this in the text or using the online resources given in the lectures.

OPTION A (Basic) A Slot Machine Simulation

Understand the Application

What it Looks Like to the User

The program will loop, asking the user for a bet amount from 0 to 50 (assume dollars, you can use ints or longs). If the user types a 0 that means she wants to quit. Otherwise, accept the amount as their bet and simulate a slot machine pull. Your program will print out a line that looks like a slot machine result containing three strings. Some examples are: BAR 7 BAR, 7 7 cherries, cherries BAR space, space BAR BAR, or cherries cherries BAR.

Each of the three positions in the string could be one of the following: "BAR", "7", "cherries" or "space".

Each of the three output positions is must be generated by your program randomly with probabilities:

BAR (40%)

cherries (30%)

space (5%)

7 (25%)

Therefore, BAR should be the most frequent symbol seen and space or 7 the least frequent.

The following combinations should pay the bet as shown (note ORDER MATTERS):

cherries [not cherries] [any] pays 5 × bet (5 times the bet)

cherries cherries [not cherries] pays 15 × bet

cherries cherries cherries pays 30 × bet

BAR BAR BARpays 50 × bet

7 7 7 pays 100 × bet

After the pull, display the three strings regardless of the outcome. If the user did not win, tell him/her "Sorry, you lose." If he won, pay him by displaying his winnings (his original bet times the winning factor from the above table). Then, repeat the whole process by requesting another bet amount.

Reference no: EM13813187

Questions Cloud

Who would be involved in idea-generating sessions : Identify some core values of this organization as best as you can. What do they believe in (beyond organizational success or profitability)?
Develop a health organization disaster planning : Develop a Health Organization Disaster Planning and Response Strategy that links federal, state, and local agency authorities and reflects the potential ethical decision-making that a health care leader may be confronted with.
What are the four supply factors of economic growth : What are the four supply factors of economic growth? What is the demand factor? What is the efficiency factor?
Write about how using cell phones while driving is dangerous : Write a paper about How using cell phones while driving is dangerous?
Investigate the use of the random generator function : For this assignment you will have to investigate the use of the C++ random generator function, rand(). Rand() produces a random integer in the range of 0 to RAND_MAX (a constant -- often 32767 -- defined in the stdlib, automatically included in al..
Key deliverables associated with the selected project : Describe the five phases of a project. Describe the key deliverables associated with the selected project(s).
Identify the main problem your audience is facing : Identify the main problem your audience is facing and which you are proposing to solve. You are writing for a relatively small business owner who is trying to decide whether or not to move to cloud computing.
Decisions of the federal open market committee : You should now find a press release from the Board of Governors of the Federal Reserve System, dated December 16, 2009, which discusses the decisions of the Federal Open Market Committee (FOMC) for that date
Who defended the british soldiers during the boston massacre : Who defended the british soldiers during the boston massacre?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Prepare a program for a company named retail-martbullprompt

prepare a program for a company named retail-mart.bullprompt the user to enter an item name one word only a quantity

  Write a function named putinorder

Write a function named "PutInOrder" that has 2 double reference parameters (say a and b). The function rearranges the values pointed to by a and b such that a points to the smallest value and b to the largest value.

  The owner of a hardware store and need to keep an inventory

You are the owner of a hardware store and need to keep an inventory that can tell you what tools you have, how many you have and the cost of each one. Write a C program to create a file named storage.dat and write the data shown in the Table 1 into t..

  Compute the average of an array of n 8-bit numbers

Write a program to compute the average of an array of N 8-bit numbers and store the result at $1000. The array is stored at memory locations starting from $1010. N is no larger than 255.

  Make a hangman game using the given parts

Make a Hangman game using the given parts

  Write a webservices application that does a simple four

write a webservices application that does a simple four function calculator. write a cgi program launched by your

  What does the term polymorphism mean

What does the term polymorphism mean and Use case models use two patterns - "Common Sub Behavior" and "Interrupts as Extensions." Explain these two patterns in your own terms and give an example for each pattern.

  Research paper on overloading operator

Write a 2 page research paper (excluding title and reference pages / double spaced) on overloading operators. Explain the concepts discussed in the textbook using at least an example not included in the textbook.

  Write program to compute federal personal income taxes

You are to write a C++ program to compute federal personal income taxes.  The tax owned depends on how much money one makes as well as their filing status.  For our purposes we will use four filing statuses.  These are (1)single filers, (2)married..

  Prepare a businesspartner

Prepare a BusinessPartner class that contains a company name, first name and a telephone number.

  Write a program that allows users to enter a dollar amount

Write a program that allows users to enter a dollar amount for their bank account balance at the beginning of the month. Then ask the user to enter a dollar amount for any number of checks written in a month, up to 50. Include an approriate sentinel ..

  Prepare a simple game of blackjack using object oriented

prepare a simple game of blackjack using object oriented programming.uml class diagramsyour project must implement the

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