subject
Computers and Technology, 14.02.2020 02:26 ohgeezy

You will be writing a program to simulate a slot machine. The player will start with $1000 and you will repeatedly ask the user how much money they wish to insert into the machine before spinning, or allow the player to quit. If the player runs out of money, the game is over. Additionally, the player cannot spend more money than they have available. You should store the player's wagers and winnings in order to output statistics when the user is done playing.

After placing a bet, the money is immediately subtracted from the player's balance. The slot machine has 3 reels which are spun after the lever is pulled. Each reel will randomly contain a integer value between 2 and 7 inclusive after being spun. If the all 3 reels have the value 7, the player obtained a jackpot and will receive the amount which they wagered times 10. If all 3 reels match, but contain a value other than 7, award the player their wagered amount times 5. Otherwise, if only 2 reels match, award the player their wager times 2. If none of the reels match, the player does not receive any earnings.

1. At the start, ask the user for a seed to use for the random number generator. Use this value to seed your random numbers.

2. Before each spin, show the user their current balance and ask for a wager.

3. The slot machine only accepts wagers containing whole dollar amounts. You may not enter any spare change.

4. You must use an array to store the value of each reel.

5. You must use a for loop to input the random values of each reel.

6. You must use a vector to store the amount of each wager.

7. You must use a vector to store the winnings of each spin.

8. If the user wagers an amount of 0 or less, stop playing and output play statistics. Additionally, if the user has a balance of $0 and is unable to wager, end the game and output play statistics. If the user never played and walks away immediately, do not output any statistics.

9. At the end, output a summary of each spin including the wager and amount won. Then output the smallest and largest wager, and the smallest non-zero winnings and the largest winnings from a single spin. Note that if the user never wins, the smallest and largest winnings displayed should be 0.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 21:00, daniella0123
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings starting from index 0. for each match, add one point to userscore. upon a mismatch, exit the loop using a break statement. assume simonpattern and userpattern are always the same length. ex: the following patterns yield a userscore of 4: simonpattern: rrgbryybgy userpattern: rrgbbrybgy
Answers: 2
image
Computers and Technology, 22.06.2019 21:30, Tcareyoliver
The salespeople at hyperactive media sales all use laptop computers so they can take data with them on the road. you are a salesperson for superduper lightspeed computers talking to hyperactive media sales about upgrading the laptops to windows 10. explain how network location awareness in windows 10 would make the laptops more secure.
Answers: 3
image
Computers and Technology, 22.06.2019 23:30, TheBurntToast
What is the digital revolution and how did it change society? what are the benefits of digital media?
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, kp2078
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
You know the right answer?
You will be writing a program to simulate a slot machine. The player will start with $1000 and you w...

Questions in other subjects:

Konu
Mathematics, 24.07.2019 07:00