Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# Code: Write the code that simulates the gambling game of craps. To play the game, a player rolls a pair of dice (2 die).

C# Code:

Write the code that simulates the gambling game of craps. To play the game, a player rolls a pair of dice (2 die). After the dice come to rest, the sum of the faces of the 2 die is calculated. If the sum is 7 or 11 on the first throw, the player wins and the game is over. If the sum is 2, 3, or 12 on the first throw, the player loses and the game is over. If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, then that sum is known as the players point. To win, he must keep throwing the dice until he/she makes his point, that is, the sum of the dice is equal to his point. The player loses if he throws a 7 before making his point. In either case, the game is over. The player will be assigned 100 chips before beginning to play the game. Each time the game is played, the user will be asked to make a wager. If the player wins the game, s(he) receives double his wager. If s(he) loses, then the wager is lost. The game is played until the player no longer wishes to play or until the chips are all used. At this time, display the total number of chips remaining.

Requirements:

  • After the first roll of the pair of dice, display the outcome as to whether the player won, lost, or the value of the players point.
  • If the player continues to roll to make his/her point, display a message as to whether he/she won or lost after he/she has either made is point or rolled a 7.
  • When a game is finished, the program should ask if the player wants to play another. It should either play another game or terminate, based on the user response.
  • When the player does not wish to play anymore or all the chips are used, display the number of chips remaining.
  • Be sure to use clear instructions to the user. You may design your output as you wish as long at it is clear to the user.
  • Include comments to explain the purpose of the code.
  • Include comments defining the purpose of the code.
  • Include your name as a comment at the beginning of the program.
  • Use all C# naming conventions as well as indentation for if statements and loops.

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

Step: 3

blur-text-image

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

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions