Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer in C++ please Write a program that starts a player off with a bank of $15.00. A coin will flip and randomly choose heads

image text in transcribedAnswer in C++ please
Write a program that starts a player off with a bank of $15.00. A coin will flip and randomly choose heads or tails. The user will guess heads or tails to win. If the coin flip matches the player's guess his bet will be doubled. It costs 1 dollar to play and the program will bet that amount automatically each time as long as there is the available bank amount. At the end of the game, ask the user if he/she would like to play again and loop the game with bet input sequence again until the bank reaches 0.00 or the user inputs "n" to quit playing. Here's what will earn point deductions: Too few functions (This should have at least 3). Don't be afraid to use functions to help modularize the parts to this game. Global variables (no00000oooooooooooOOOOOoo! -Darth Vader) Too many win case evaluations. There should only be if you win or lose. Do not check against both heads and tails and this, and that. You will create a permutation of every outcome. This is not a smart approach. Think, how do you win? You win if your guess is == to the coin flip. I'll soy no more. Syntax errors Improper logic or improper function arguments/return type Duplication of code. If you're writing the same thing twice, you're not leveraging functions or proper logic. Round peg, square hole. i.e Don't use a for loop and try convert it to a while loop. Use the right tool for the job. The completed program should look like the following: This is a flowchart just to help you organize functionality flow. You may deviate as long as it doesn't undermine the intentions. Write a program that starts a player off with a bank of $15.00. A coin will flip and randomly choose heads or tails. The user will guess heads or tails to win. If the coin flip matches the player's guess his bet will be doubled. It costs 1 dollar to play and the program will bet that amount automatically each time as long as there is the available bank amount. At the end of the game, ask the user if he/she would like to play again and loop the game with bet input sequence again until the bank reaches 0.00 or the user inputs "n" to quit playing. Here's what will earn point deductions: Too few functions (This should have at least 3). Don't be afraid to use functions to help modularize the parts to this game. Global variables (no00000oooooooooooOOOOOoo! -Darth Vader) Too many win case evaluations. There should only be if you win or lose. Do not check against both heads and tails and this, and that. You will create a permutation of every outcome. This is not a smart approach. Think, how do you win? You win if your guess is == to the coin flip. I'll soy no more. Syntax errors Improper logic or improper function arguments/return type Duplication of code. If you're writing the same thing twice, you're not leveraging functions or proper logic. Round peg, square hole. i.e Don't use a for loop and try convert it to a while loop. Use the right tool for the job. The completed program should look like the following: This is a flowchart just to help you organize functionality flow. You may deviate as long as it doesn't undermine the intentions

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

Whal are values?

Answered: 1 week ago