Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a class RandomPlayer which performs some tests using a Random object. RandomPlayer has this constructor: public RandomPlayer(Random generator, int upperBound, int numberOfIterations) where generator

Write a class RandomPlayer which performs some tests using a Random object.

RandomPlayer has this constructor:

public RandomPlayer(Random generator, int upperBound, int numberOfIterations) where

generator is the Random object

upperBound is the maximum value of the generated numbers. If upperBound is 50, then generate random ints greater than or equal to 0 and less than 50 in the methods.

numberOfIterations is the number of random ints to generate (the number of times to run your loop).

It has these methods

public double average() - generates the specified number of random ints and gets the average of the values generarated.

public int countGreaterThanMidValue() - generates the specified number of random ints and counts how many are greater than the upperBound / 2. You would expect it to be about half the time, but is it? Do not calculate the average in this method call average()

public int count(int value) - generates the specified number of random ints and gets the number of times the value appears

public void setIterations( int numberOfIterations)sets the number of iterations for this object

Provide Javadoc

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

More Books

Students also viewed these Databases questions

Question

Repeat Prob. 3128 for isobutene.

Answered: 1 week ago

Question

3. Would you say that effective teamwork saved their lives?

Answered: 1 week ago