Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the craps program to allow wagering as follows: Initialize variable bankBalance to 1000 dollars. Prompt the player to enter a wager Check that wager

image text in transcribedimage text in transcribed

Modify the craps program to allow wagering as follows: Initialize variable bankBalance to 1000 dollars. Prompt the player to enter a wager Check that wager is less than or equal to bankBalance, and if it's not, have the user reenter wager until a valid wager is entered. Then, run one game of craps. If the player wins, increase bankBalance by wager and display the new bankBalance. If the player loses, decrease bankBalance by wager, display the new bankBalance, check whether bankBalance has become zero and, if so, display the message "Sorry. You busted!" As the game progresses, display various messages to create some "chatter," such as: oh, you 're going for broke, huh? or "Aw c'mon, take a chance!" or "You 're up big. Now 's the time to cash in your chips!" etc Implement the "chatter" as a separate method that randomly chooses the string to display. Suggestions: the chatter( method takes a craps game outcome (win or lose) as an input parameter. If it is Status. WON, then this method return a congratulations string, otherwise, it returns a conciliatory sentence. If you have k1 congratulation statements, then generate a random integer between 1 and k1 and use a switch statement to select the corresponding congratulation statement. Similarly, if you have k2 conciliatory sentences then generate a random integer between 1 and k2 and use a switch statement to select the corresponding conciliatory sentence

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

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

4. How does the worker do the job?

Answered: 1 week ago

Question

What is Working Capital ? Explain its types.

Answered: 1 week ago