Question
In Java, SlotMachine In main: Ask for the number of times to run the game. Read in a seed as type long. For each time
In Java, SlotMachine
In main:
Ask for the number of times to run the game.
Read in a seed as type long.
For each time you run the game
Increment seed by 1
Call runGame with the incremented seed.
Based on the returned value keep count of the wins and losses.
Print out the number of wins as an integer and the percentage of wins to decimal places as below:
The number of games won is numWins and the percentage of wins is pctWins%.
In runGame: (10)
Use the Random class to do the following
Create a Random object.
Set the seed based on the input value.
Generate 3 integers between 1 and 5 (inclusive).
Return true if all three match (a win) or false otherwise.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started