Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help desinging a java code for the following project. It is an intro code class for java and I'm primarily having trouble designing

I need help desinging a java code for the following project. It is an intro code class for java and I'm primarily having trouble designing the random number game method. I've included the instructions as well as an example of the program execution.

A program is needed that will simulate a game of chance, where the player bets on the outcome of a Snail Race. The player will be allowed to repeatedly select one of the following choices from the menu as long as the player does not choose to quit the game or the player has not lost all of his/her money through choosing snails that did not win a race. Choose a snail upon which to place a bet Choose to just watch a race, but not place a bet on a snail Choose to leave the races (quit the game) When the player selects a snail, the game action will proceed as follows: provide the player the ability to enter an amount of money that he/she wants to wager on the snail winning the race simulate the racing of the snails through the use of the random number generator to determine which of the snails wins the race and display which snail won the race determine whether the players chosen snail won the race and either add to the players money by 2 times the bet if the players chosen snail won or subtract from the players money the amount of the bet if the players chosen snail did not win the race display the players current amount of remaining money re-display the game menu to the player and allow the game to begin again with the remaining amount of players money Should the player select the option to Just Watch, the game action will proceed as follows: simulate the racing of the snails through the use of the random number generator to determine which of the snails wins the race display the players current amount of remaining money re-display the game menu to the player and allow the game to begin again with the remaining amount of players money Should the player select the option to Leave the races or the player has lost all of his money in the game, the game action will proceed as follows: drop out of the game loop following the game loop determine whether the player has any money left and output one of the following messages before ending the program: o if player has no money left output a message that wishes the player better luck next time and asks him/her to come play again soon o if player has more money left than starting amount output a message that congratulations the player on the winnings and asks him/her to come play again soon. Page 2 of 5 o if player has some money left output a message that thanks the player for playing and asks him/her to come play again soon an example of the program output would be: Welcome to the snail races! You have 200.00 dollars. Races Menu 1) Bet on Speedy 2) Bet on Zippy 3) Bet on Slick 4) Just watch, no bet 0) Leave the races Select a snail: 1 Snail Speedy is a good choice! How much would you like to bet on Speedy 50.00 And the snails are off Look at them GO!!! The winner is Slick You lose -50.00 dollars

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_2

Step: 3

blur-text-image_3

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

=+What kinds of problems need to be overcome?

Answered: 1 week ago