C++ Please For this assignment, you will write a program that lets the user play against the...

50.1K

Verified Solution

Question

Programming

C++ Please

For this assignment, you will write a program that lets the userplay against the computer in a variation of the popular blackjackcar game. In this variation of the game, two-six sided dice areused instead of cards. The dice are rolled, and the player tries tobeat the computer's hidden total without going over 21.

Here are some suggestions for the game's design:

  • Each round of the game is performed as an iteration of a loopthat repeats as long as the payer agrees to roll the dice, and theplayer's total does not exceed 21.
  • At the beginning of each round, the program will ask the userswhether they want to roll the dice to accumulate points.
  • During each round, the program simulates the rolling of twosix-sided dice. It rolls the dice first for the computer, then itasks the user if he or she wants to roll.
  • The loop keeps a running total of both the computer and theuser's points.
  • The computer's total should remain hidden until the loop hasfinished.
  • After the loop has finished, the computer's total is revealed,and the player with the most points without going over 21wins.

You will need to create 2 class files for this assignment.

  1. One class will hold the dice information. (Variable to storethe value and number of sides, constructor that creates the dicewith 6 sides, accessor and mutators, method to roll the dice, andtoString).
  2. One class will hold the user information. (Variable to storetotal score, constructor that creates the user with a default of 0points to start, accessor and mutators, method to set reset theirscore, and toString).

Answer & Explanation Solved by verified expert
3.6 Ratings (577 Votes)
Code to copy along with screenshots of code andoutput are providedPlease refer to screenshots to understand the indentation ofcodeIf you have any doubts or issues    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students