Question: Create a new Console Application using the .NET Framework. This application will allow users to bet tokens on a guessing game. Game Mechanics The user
Create a new Console Application using the .NET Framework. This application will allow users to bet tokens on a guessing game.
Game Mechanics The user will start off with 100 tokens. The user will be allowed to bet an amount of tokens, and then attempt to guess a number as long as they have tokens remaining. If the user guesses the number correctly, they win some tokens back. During each round of the game, the following actions should occur: 1.) Display the current total number of tokens. 2.) Prompt the user a menu of options to bet either 10 tokens, 50 tokens, or ALL of their tokens. The user should always have at least 10 tokens, so the first and last options should always work. However, if the user chooses to bet 50 tokens and does not have at least 50 tokens, ask the user to try again. If the user chooses an invalid menu option, ask the user to try again 3.) Once the user has chosen their bet, subtract the bet amount from their total tokens and then generate a random secret number between 1 and 3 (see Note 2 below). Next, prompt the user to enter a number between 1 and 3. If the user does not enter a valid integer between 1 and 3 keep re-prompting until a valid value is entered. 4.) If the user guesses the secret number, add the following tokens to the user's token count: a.) If the user bet 10 tokens, add 20 tokens (or 2x the bet amount). b.) If the user bet 50 tokens, add 150 tokens (or 3x the bet amount) c.) If the user bet ALL tokens, add 5x the number of tokens bet. 5.) If the user guesses incorrectly, display what the correct secret number was After all tokens have been spent, output the total number of games won Note 1: Use the following two lines of code at the top of your Main) method in order to create an object that can generate random numbers: Random rng-new Random(); int number Note 2: Whenever you are ready to generate a new secret number, use the following statement // Generate the a random number between 1 and 3 number rng.Next(1, 4)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
