Advanced Placement (AP)

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 sectorsspinning a spinner and reporting the resultreporting the length of the current run, the number of consecutive spins that are the same as the most recent spinthe following table contains a sample code execution sequence and the corresponding results. statements value returned(blank if no valuereturned) commentgamespinner g = new gamespinner(4); creates a new spinner with four sectorsg. Currentrun(); 0 returns the length of the current run. The length of the current run is initially 0 because no spins have occurred. g. Spin(); 3 returns a random integer between 1 and 4, inclusive. In this case, 3 is returned. g. Currentrun(); 1 the length of the current run is 1 because there has been one spin of 3 so far. g. Spin(); 3 returns a random integer between 1 and 4, inclusive. In this case, 3 is returned. g. Currentrun(); 2 the length of the current run is 2 because there have been two 3s in a row. g. Spin(); 4 returns a random integer between 1 and 4, inclusive. In this case, 4 is returned. g. Currentrun(); 1 the length of the current run is 1 because the spin of 4 is different from the value of the spin in the previous run of two 3s. g. Spin(); 3 returns a random integer between 1 and 4, inclusive. In this case, 3 is returned. g. Currentrun(); 1 the length of the current run is 1 because the spin of 3 is different from the value of the spin in the previous run of one 4. g. Spin(); 1 returns a random integer between 1 and 4, inclusive. In this case, 1 is returned. g. Spin(); 1 returns a random integer between 1 and 4, inclusive. In this case, 1 is returned. g. Spin(); 1 returns a random integer between 1 and 4, inclusive. In this case, 1 is returned. g. Currentrun(); 3 the length of the current run is 3 because there have been three consecutive 1s since the previous run of one 3. write the complete gamespinner class. Your implementation must meet all specifications and conform to the example