Question: 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

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!