subject
Computers and Technology, 19.05.2020 20:03 Jasten

Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied.
In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit.
This question involves the creation and use of a spinner to generate random numbers in a game. A GameSpinnerobject 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 length of the current run, the number of consecutive spins that are the same as the most recent spin
The following table contains a sample code execution sequence and the corresponding results.
Statements ValueReturned(blank ifno valuereturned) Comment
GameSpinner g = new GameSpinner(4); Creates a new spinner with four sectors
g. 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 4is 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 3is 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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 04:31
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
Acompany is hiring professionals for web designing. the firm is small with few resources. they want employees who possess problem-solving skills and can independently carry out responsibilities. which kind of employee should they select?
Answers: 2
question
Computers and Technology, 25.06.2019 00:30
Which email writing etiquette should ariel follow to let people know that she received their message? a. reply to their messages immediately b. use formal language c. specify the email's intent in the subject field d. be direct when writing the reply
Answers: 1
You know the right answer?
Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
Questions
question
Mathematics, 05.12.2020 03:50
Questions on the website: 13722360