QuestionQuestion

One of the largest facets of computer programming is games simulations (not only for commercial games but for marketing, political, engineering, scientific research). This application will allow the player to run a game of roulette.

• There are 37 numbers, zero to 36. You win if your number or one of your numbers comes up
• The wheel is color coded according to:
1) Odd Numbers Between 1 to 9 and 19 to 27 are Red
2) Even Numbers Between 2 to 10 and 20 to 28 are Black
3) Odd Numbers Between 11 to 17 and 29 to 35 are Black
4) Even Numbers Between 12 to 18 and 30 to 36 are Red
5) Zero is Green
• Allow the user to play as long as they wish
• Bets allowed:
1) Red OR Black
2) Bet that ODD Number appears or bet that an Even Number appears
3) Bet that 1 to 18 Will Come Up
4) Bet that 19 to 36 Will Come Up
5) Bet that 0, 2 or 3 Will Come Up (Trio)
6) Bet that 0, 1, 2 or 3 Will Come Up (Basket)
7) Bet that one particular Number (0 to 36) will Come Up
8) Quit
• Use a function to determine the wheel number (0 to 36)
• Use a function to determine that number’s color (i.e. if zero then “Zero Green”, if 9 then “Red 9”, if 14 then “Red 14”, if 13 then “Black 13”

We will “dispense” with GIGO for brevity.

What does the wheel look like?
0 Green
1, 3, 5, 7, 9 Red
2, 4, 6, 8, 10 Black

11, 13, 15, 17 Black
12, 14, 16, 18 Red

19, 21, 23, 25, 27 Red
20, 22, 24, 26, 28 Black

29, 31, 33, 35 Black
30, 32, 34, 36 Red

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include <cstdlib>
#include <ctime>
#include <string>
#include <sstream>
#include <iostream>

using namespace std;

// constant variables
const int RED = 1;
const int BLACK = 2;
const int ZERO = 0;
const int ROULETTE_CELLS_NUM = 37;

/// function prototypes
int wheelNumber();
int numberToColor(int number);
string colorByRange(int number);
string numberColor(int number);
void printBeMenu();
int redBlack(int number);
int oddEven(int number);
int oneToEighteen(int number);
int nineteenToThirtySix(int number);
int trio(int number);
int basket(int number);
int particular(int number);

int main(int argc, char** argv) {
   
    srand((unsigned)time(NULL));
    int option = 0;
    int number;
    int result;
    double win = 0.0;;
    double total = 0.0;
    while (option != 8) {
       number = wheelNumber();
       printBeMenu();
       cin >> option;...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$35.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats