Question: *JAVA* Since a trip to Vegas can get quite expensive, as programmers we can be clever and create our own gambling experience. Write a program

*JAVA*

Since a trip to Vegas can get quite expensive, as programmers we can be clever and create our own gambling experience. Write a program that simulates a slot machine by asking the user to enter the amount of money they want to bet. The lowest amount they can bet is $1. Next, simulate spinning the machine by choosing one of these words randomly: Cherries, Oranges, Plums, Bells, Melons, Bars You can do this easily by generating a random number with a value between 0 - 5. Each number corresponds to a string, for example 0 = Cherries, 1 = Oranges and so on. Select a random string 3 times and output the result of the spin. The next thing to do is to determine the result of the spin. The results are based on these rules: If none of the words match, the player loses half their money. (e.g., $20 becomes $10) If two of the words match, the player doubles their money. (e.g., $20 becomes $40) If all three match, the player gains 5 times their money. (e.g., $20 becomes $100) Finally, show the player their total amount at the end of the round and ask if they want to play again as long as their money is greater than $1. Repeat the spin if they want to play again. If they dont, or their total is less than $1, quit the program. 

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!