Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write the answers clear and easy to be read and please sipirt the answers so It would be in order SlotMachine Class Your first

image text in transcribed

image text in transcribed

image text in transcribed

Please write the answers clear and easy to be read and please sipirt the answers so It would be in order SlotMachine Class Your first project is to model a slot machine in Java. This slot machine will have three reels, and each reel will have seven digits: 1 - 7. The first reel is on the left, the second in the center, and the third is on the right. If the first two numbers match, the player is awarded the amount of their bet times the value of the two numbers. If all three match, they get awarded the value of their bet times the value of the three numbers...times five! Below are the results of a few different games, assuming a $1 bet by the player 487: player wins $0 (none of the number match) 338 player wins $3 (3 x $1) 662: player wins $6 (6x $1) 777: player wins $35 (7x $1 x 5) 277: player wins $0 (wins are only awarded when contiguous numbers match from left-to- right) Create a class called SlotMachine that can generate three random number between 1 and 7 when you "spin" the reels. The SlotMachine class should be a separate file from the driver class, which you will call SlotMachineDemo. SlotMachineDemo is the file that will be run to test and execute your program These are the ways you'll earn points for your program: 4 points: Generate three random numbers between 1 and 7 and display them to the player 2 points: start the game with $100 and keep track of the player's money each time they spin (default bet of $1) 1 point: allow the player to change their bet so they can bet more than $1 (no limit) - we'll let them go negative, they can pay us later. 1 point: allow the player to cash out, ie: quit the game and see their final winnings (this can be a negative amount) 1 point: play your game one million times, and report your ending balance in a print statement. 1 point: Good Javadoc comments* that explain and document your code for the TA, and anyone else who reads it. Good Javadoc commentsIt will be up to your TA to decide just how good your Javadoc comments are. But here's a tip: make sure they are present! You will generally want to add them before each class to explain what the class does, before the instance variables to explain those, and before each method to explain the return type and parameters (use the Javadoc syntax) Below is an example of some input/out: Welcome to Dragons of Thunder Slots You have $100 to Start. Enter-1 to cash out. Bet Amount: 10 Win: $0 Balance: $90 Bet Amount: Win: $35 Balance: $120 Bet Amount: 20 65|2 Win: $0 Balance: $100 Bet Amount: 20 Win: $0 Balance: $80 Bet Amount: Thanks for playing. Ending balance: $80 After 1,000,000 more games: Win: $4 Balance: $-106338

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

Step: 3

blur-text-image

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

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions