Question
language is c++ and need to run it in code blocks. Description: For this project you are going to create a Casino simulator. The user
language is c++ and need to run it in code blocks.
Description:
For this project you are going to create a Casino simulator. The user can play any one of the games at the casino as long as they want and in any order that they want provided they have not gone bankrupt! The games at the casino are high-low, roulette, and 21. The user should be able to leave the casino (exit the program) at any time from the program's main menu.
Requirements:
Have users start with a random amount of money between $100 and $200. The program should tell users how much money they have and then display a menu with the following options:
1) Play High-Low 2) Play Roulette 3) Play 21 4) Set betting amount 5) Leave Casino
The program must have separate functions to perform each of options 1-4 in the menu. Additionally, the menu should be a function that is called from main. Thus, you should have at least 5 functions in addition to main (feel free to have more if you like). The "Set betting amount" function should allow the user to set an amount to be used as the wager in each game. Allow users to set any amount they want as long as it is less than their total balance! Make the default for this amount $5, just in case users start playing before they set their bet. You should display the user's current balance before each round of any game.
The following is a description of how each game at the Casino is played:
High-Low: The computer should randomly generate a number between 1 and 10, and then display this number for the user. The user then picks whether the next number will be higher or lower than the first. The computer generates the next number and displays it. If users were right, they win; wrong, they lose! This game pays whatever the betting amount.
Roulette: Users pick a color (either red or black) and a number between 1 and 13. The computer then generates a random color and number and displays them. If the user's color matches only the computer's color, pay the betting amount. If the user's number matches only the computer's number, pay four times the betting amount. If both the numbers and colors match, pay 16 times the betting amount. If nothing matches, the user loses.
21: The object of this game is to get as close as you can to 21 points without going over. Users should start with two randomly generated values between 1 and 10 (we'll simplify the game by assuming aces always count as 1 point). To make this game work somewhat close to reality, you should randomly generate a value between 1 and 13, then make numbers bigger than 10 equal to 10 (this simulates Jacks, Queens, and Kings). Once users' first two values are generated, display their sum. Ask users if they want to hit or stay. If they hit, generate another value and add it to their sum. Keep giving them this prompt until they go over 21 (in which case they lose) or decide to stay. Now generate a random value for the computer between 16 and 23 and display it. If the computer gets a 22 or 23, it goes over and users win. If users have more points than the computer they also win, otherwise the computer wins. This game pays 3 times the betting amount. HINT: It would simplify things to write a function that generates numbers for users.
Users should be able to keep playing each game until they decide to quit or they go bankrupt. Once they have selected a game from the main menu, prompt users after each round of that game to see if they want to keep playing that game. If they say yes, then play another round of the current game. If they say no, the program should return to the main menu. Only allow the program to end from the main menu.
You should use appropriate commenting and indentation in your code, as discussed in class. Make sure your name is in comments at the top of your code. If this is not done, expect significant points to be deducted from your program. You are not allowed to use GLOBAL VARIABLES.
Additional Information:
To calculate the balance for the player after winning a game, use the formula: balance = balance + payoff*bettingAmount. If they lose, use the formula: balance = balance - bettingAmount.
additional part:
1. Modify the program so that your Casino has the following game as an additional option
Lottery: Users select a random number between 1 and 100. The computer then generates a random number between 1 and 100 and displays it. If users were right, pay them 100 times the betting amount! It they were wrong, they lose. Since this game has such a high payoff, don't users play unless they bet at least $20.
2. Write in the comments at the top of the code that you are missing credit for a lab activity and the date of the missing lab credit. Do not expect to receive any make-up credit without this information in comments at the top of the program.
What to hand in:
Before the due date and time you should upload your .cpp file through this assignment description. Remember, assignments that do not compile will receive no more than 50%. Make sure your code compiles!
Rubric
Project 2 Rubric
Project 2 Rubric
Criteria Ratings Pts This criterion is linked to a Learning OutcomeCommenting Name, e-mail address, and description of the code should be at the top of each .cpp file. In addition, you should have comments throughout your code explaining the code. 5.0 pts This criterion is linked to a Learning OutcomeCode Style Your code should use indentation appropriately, as discussed in class. 5.0 pts This criterion is linked to a Learning OutcomeSyntax Projects that do not compile will receive no more than 50% credit. You should remove all syntax errors from your code. Projects must compile and run to earn points on the criteria that follow this one. 40.0 pts This criterion is linked to a Learning OutcomeHigh-Low The program contains a function that correctly implements the high-low game. 10.0 pts This criterion is linked to a Learning OutcomeRoulette The program contains a function that correctly implements the game of roulette. 10.0 pts This criterion is linked to a Learning Outcome21 The program contains a function that correctly implements the game of 21. 10.0 pts This criterion is linked to a Learning OutcomeSet betting amount The program contains a function that correctly sets the betting amount. 5.0 pts This criterion is linked to a Learning OutcomeMain menu function The program contains a function that correctly implements the main menu. 5.0 pts This criterion is linked to a Learning OutcomeMain program loop Players can play the games at the casino until they run out of money or they choose to leave from the main menu. 5.0 pts This criterion is linked to a Learning OutcomeMoney The player's money is implemented correctly (i.e. money is modified correctly after each round of each game played). Money is correctly transferred from one game to another. 5.0 pts Total Points: 100.0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started