Question: This question is in Java. Please help. This question involves the creation and use of a spinner to generate random numbers in a game. A

 This question is in Java. Please help. This question involves the

This question is in Java. Please help.

This question involves the creation and use of a spinner to generate random numbers in a game. A GameSpinner object represents a spinner with a given number of sectors, all equal in size. The GameSpinner class supports the following behaviors. Creating a new spinner with a specified number of sectors Spinning a spinner and reporting the result Reporting the average spin of a spinner object. This is initially 0 until a spinner is spun. Reporting the largest (most sectors) GameSpinner object that has been created. The following table contains a sample code execution sequence and the corresponding results. Method Call Value Explanation Returned (blank if no value) GameSpinner gi Creates a new spinner with 4 sectors new GameSpinner (4); gl. avgSpin(); 0.0 Returns the average spin of the current spinner. The average spin for the current spinner is initially o because no spins have occurred. GameSpinner.biggest(); 4. Returns the largest GameSpinner object that has been created. The largest created so far is a GameSpinner with 4 sectors. g1.spin(); 4 Returns a random integer between 1 and 4, inclusive. In this case, 4 is returned. gl.spin(); 3 Returns a random integer between 1 and 4, inclusive. In this case, 3 is returned. gl.avgSpin(); 3.5 The average spin is 3.5 because 2 spins of 4 and 3 have occurred so far. (4+3)/2 3.5 gl.spin(); 2. Returns a random integer between 1 and 4, inclusive. In this case, 2 is returned. gl.avgSpin(); 3.0 The average is (4+3+2)/3 = 3 GameSpinner g2 Creates a new spinner with 5 sectors new GameSpinner (5); 92.avgSpin(); 0.0 The average spin for the current spinner is initially o because no spins have occurred. GameSpinner.biggest(); 5 The largest GameSpinner object created now is one with 5 sectors. Write the complete GameSpinner class. Your implementation must meet all specifications and

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!