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, 22.06.2019 03:40
Hello my name is mihai and i need your : )i have to do a python project in computer science and i’m really busy with my mocks this period of time besides this i’m not good at coding so could someone pls pls pls sort me out ? i actually beg ; ))
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Which best describes the role or restriction enzymes in the analysis of edna a. to break dna into fragments that vary in size so they can be sorted and analyzed b. to amplify small amounts of dna and generate large amounts of dna for analysis c. to purify samples of dna obtained from the environment so they can be analyzed d. to sort different sizes of dna fragments into a banding pattern that can be analyzed
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Freya realizes she does not have enough in her bank account to use the debit card. she decides to use a credit card instead. which questions should freya answer before using a credit card? check all that apply. can i pay at least the minimum payment each month? can i make payments on time and avoid late fees? will i have to take out a loan? how much in finance charges can i afford to pay? should i talk to a consumer credit counseling service?
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
How many points do i need before i can send a chat
Answers: 1
You know the right answer?
Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
Questions
Questions on the website: 13722363