Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAMMING You are required to create a simple slot machine with three slots. Each slot will generate a random number from 1 to 9.

JAVA PROGRAMMING

You are required to create a simple slot machine with three slots. Each slot will generate a random number from 1 to 9. The user will start with 100 coins and can bet any number of coins per slot pull. The payouts are defined as follows:

If 2 slots equal each other the user wins 2x the bet.

If 3 slots equal each other the user wins 10x the bet.

If 0 slots equal the user loses the bet.

The game continues until the user is out of coins or the user chooses to quit the game by entering 0.

Your program checks to be sure that the user bets appropriate amount of coins for a play (i.e., bet has to be within current amount).

Sample inputs/outputs

You have 100 coins.

Enter 0 to exit or any other number to play that many coins per spin

10

Spin: 1 7 7

You won 20 coins! You now have 120 coins.

Enter 0 to exit or any other number to play that many coins per spin

1000

Your bet cannot exceeds 120 coins.

Enter 0 to exit or any other number to play that many coins per spin

-1

Your bet cannot be negative.

Enter 0 to exit or any other number to play that many coins per spin

110

Spin: 9 1 2

You lost 110 coins. You now have 121000 coins.

Enter 0 to exit or any other number to play that many coins per spin

10

Spin: 4 5 6

You ran out of coins. Thanks for playing.

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

Intelligent Information And Database Systems 12th Asian Conference ACIIDS 2020 Phuket Thailand March 23 26 2020 Proceedings

Authors: Pawel Sitek ,Marcin Pietranik ,Marek Krotkiewicz ,Chutimet Srinilta

1st Edition

9811533792, 978-9811533792

More Books

Students also viewed these Databases questions