Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is C++ question. I already have a solution for dice version blackjack, but I must include these 4 functions. You MUST include the functions

This is C++ question. I already have a solution for dice version blackjack, but I must include these 4 functions.

\You MUST include the functions from these prototypes (As per book , bust may be int or bool)

1) int rolldice ();

2) int getwager (int money);

3) void playerturn (int money, int &wager, int &bust, int &total, int &houseroll);

4) void houseturn (int houseroll, int &bust, int &total);

image text in transcribed

image text in transcribed

9. Write a program that plays a simplified dice version of blackjack. Instead of selecting from a deck of cards, a 14-sided die is rolled to represent a card. The rules of the game for one round, as played against the house, are as follows: 1. A roll randomly selects from the values 2-10 or Jack, Queen, King, or Ace. An Ace always has the value of 11. Jack, Queen, and King all have the value of 10, In other words, with equal probability, a roll selects one of 2.3,4,5,6,7,8,9,10,10,10,10,11. he human player enters a wager. The wager must be positive and must 3. The player is given two rolls. The house, played by the computer, is 4. If the total of the rolls is 22 or greater than the player "busts", loses the not exceed the amount of money possessed by the player. given one roll. The player is shown the value of the house's roll. wager, and the round is over. 5. If the total of the rolls is 21 or less then the player has the option to hit" or "stand". If the player opts to "hit" then the player is given an- other roll. Return to step 4. If the player opts to "stand" then continue to step 6. 6. It is now the house's turn. The house is given an additional roll and the values are summed. If the total is less than 17 then the house must "hit". If the house has a total of 22 or greater than the house "busts" the player wins the wager, and the round is over. The house must continue to hit until it either "busts" or has a value between 17 and 21. 7. If the house did not "bust" then its value is compared to the player's total. If the totals are the same then it is a "push" and the player does not win or lose anything. If the house's total is greater than the play- er's, then the player loses the wager. If the player's total is greater than the house's, then the player wins the wager Write a program that repeats a round until the player decides to quit or runs out of money. Start the player with $100. Write your program using the bottom-up development methodology. You should write drivers to test your functions before writing higher-level code to implement the game logic. At a minimum, you should start with the following functions: 9. Write a program that plays a simplified dice version of blackjack. Instead of selecting from a deck of cards, a 14-sided die is rolled to represent a card. The rules of the game for one round, as played against the house, are as follows: 1. A roll randomly selects from the values 2-10 or Jack, Queen, King, or Ace. An Ace always has the value of 11. Jack, Queen, and King all have the value of 10, In other words, with equal probability, a roll selects one of 2.3,4,5,6,7,8,9,10,10,10,10,11. he human player enters a wager. The wager must be positive and must 3. The player is given two rolls. The house, played by the computer, is 4. If the total of the rolls is 22 or greater than the player "busts", loses the not exceed the amount of money possessed by the player. given one roll. The player is shown the value of the house's roll. wager, and the round is over. 5. If the total of the rolls is 21 or less then the player has the option to hit" or "stand". If the player opts to "hit" then the player is given an- other roll. Return to step 4. If the player opts to "stand" then continue to step 6. 6. It is now the house's turn. The house is given an additional roll and the values are summed. If the total is less than 17 then the house must "hit". If the house has a total of 22 or greater than the house "busts" the player wins the wager, and the round is over. The house must continue to hit until it either "busts" or has a value between 17 and 21. 7. If the house did not "bust" then its value is compared to the player's total. If the totals are the same then it is a "push" and the player does not win or lose anything. If the house's total is greater than the play- er's, then the player loses the wager. If the player's total is greater than the house's, then the player wins the wager Write a program that repeats a round until the player decides to quit or runs out of money. Start the player with $100. Write your program using the bottom-up development methodology. You should write drivers to test your functions before writing higher-level code to implement the game logic. At a minimum, you should start with the following functions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

What do you like to do in your spare time?

Answered: 1 week ago

Question

Why is timing considered important in synchronous transmission?

Answered: 1 week ago