Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write In C++ It should run on Dev C++ compiler You are to create an electronic dice game based on the Craps. the basic rules

Write In C++ It should run on Dev C++ compiler

You are to create an electronic dice game based on the Craps. the basic rules are:

A player rolls two 6 sided dice. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. On the first throw:

  • If the sum is 7 or 11 the player wins.
  • If the sum is 2,3,or 12 (called "craps" ) the player loses and the house wins.
  • If the sum is 4,5,6,8,9, or 10 on the first throw, then that sum becomes the player's point

On subsequent throws

  • the player must continue rolling the dice until they "makes the point", i.e. rolls the same sum again. If the player rolls 7 before making the point, they lose.
  • Write a the following functions
    • getPlayer - get the player's first and last name separately (not all in one string)
    • getWager - get the amount of money the player wishes to wager on this game - win returns 2x, lose it all goes away.
    • rollDie - to simulate the rolling of a single six sided die. This function should return a random number between 1 and 6
    • firstRoll to simulate the first roll. This function should call rollDie two times.
      • It should then return:
        • 0 for a winning roll
        • -1 for a losing roll
        • the total roll value for non-winning / non-losing rolls aka the point
    • makePoint to simulate the later rolls. This function should take as input the "point" to be made
      • It should then return
        • -1 for a losing roll
        • 0 for non-winning / non-losing rolls
        • 1 for a winning roll
    • printResult to print the result of the die roll(s) when the player either wins or loses - this function needs a message and more depending on how you build it out

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

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions

Question

1. In what ways has flexible working revolutionised employment?

Answered: 1 week ago