Programmers generally will create an outline of a program before they start writing code. Due to the size of this program it is a good idea for you to have an outline that describes how the code will be written. Download the outline here. Write a program that simulates the game of craps. Craps is a dice game played in casinos. The game involves betting on a pair of dice that are rolled across a craps table. The actual game of craps has many rules. You will write a program based on a simplified set of rules.
Simplified Rules: On the first roll:
7 or an 11 wins 2,3 or 12 loses 4,5,6,8,9 or 10 becomes your point. On all other rolls:
rerolling your point from the first roll wins 7 loses The player places a bet before the first roll. If he wins then the amount of the bet is added to his cash. If he loses the amount of the bet is subtracted from his cash.
Project Requirements: - The game should welcome the user to your casino.
- The player's name should be entered and used during the game.
- The computer should display the rules for Craps if the user needs wants them.
- The player should start with $500.
- A bet between 0 and the amount of cash available must be entered before rolling the dice.
- The player should be allowed to play until he/she goes broke or chooses to quit.
- After quitting the computer should send a message stating how much money was earned or lost by the player.
- The computer needs to keep track of the highest amount of winnings achieved and use that information as a way to congratulate or taunt the player as needed.
- No cheating of any kind!
Special note: To enable the computer to respond to the user pressing the Enter key to roll again you will need to use nextLine() rather than next().
Sample output:
Welcome to Jim's World-O-Craps Please enter your name: Wilbur
Wilbur, you will start the game with $500. Good luck.
Please enter your bet: $50
You rolled 7 and win!! You now have $550. Would you like to play another round? (Y/N): Y
Please enter your bet: $250
You rolled 8. 8 is your winning number.
You rolled 12 and will need to roll again.
You rolled 5 and will need to roll again.
You rolled 7 and lost. You now have $300. Would you like to play another round? (Y/N): N
Good-bye.
|