Question: PLEASE WRITE THE PROGRAM IN C# OR C++ In this assignment you will write a program to play craps and to bet on the outcomes

PLEASE WRITE THE PROGRAM IN C# OR C++

In this assignment you will write a program to play craps and to bet on the outcomes of the games.

Specifically, you will get practice correctly implementing while and/or do-while loops.

Craps is a simple dice game. You roll two dice. If you get a 7 or an 11 on this first roll you win; if you get a 2 or a 12 on the first roll you lose; otherwise the result of the first roll is called your point. You then continue to roll the dice until you match the point (in which case you win) or until you roll a 7 (in which case you lose).

You are to write a program that allows the user to place a bet (on either winning or losing) and play a game of craps. It should continue until the person doesn't want to play anymore or until he or she runs out of money. Have the player start with $100 dollars. Don't allow bets that are less than 0 or more than the player has.

The computer rolls the dice by setting each of the two dice values to a random value between 1 and 6 and adding the two values together.

Here is a sample run.

[Some introductory remarks....] You have $100 dollars. How much would you like to bet? $40 Are you betting on winning(y/n)? y Press return key to roll the dice. You rolled a 3 and a 4 for a total of 7. Congratulations! You won the game and the bet! You won $40. You now have $140. Would you like to play again (y/n)? j That was not a valid response. Please type y or n. Would you like to play again(y/n)? y ================================================================ You have $140. How much would you like to bet? $150 That's more money than you have. You have $140. How much would you like to bet? $130 Are you betting on winning(y/n)? n You rolled a 3 and a 2 for a total of 5.

5 is your point.

Press return key to roll the dice.

You rolled a 3 and a 5 for a total of 8.

5 is your point.

Press return key to roll the dice.

You rolled a 1 and a 4 for a total of 5.

You won the game but you lost the bet. You lost $130. You now have $10.

Would you like to play again(y/n)? n

==================================================================

Bye. You lost $90.

As the sample shows, you should reject anything other than a y" or a n" when asking if the user wants to play again. Feel free to make the output nicer as long as it includes the basic information shown here.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!