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 length of the current run, the number of consecutive spins that are the same as the most recent spin

write the complete gamespinner class. your implementation must meet all specifications and conform to the example.

Answers

Answer 1

Using the knowledge in computational language in JAVA it is possible to write a code that  generate random numbers in a game

Writting the code in JAVA:

public class GameSpinner {

int spinner;

int num;

int current;

public GameSpinner(int spinner) {

super();

this.spinner = spinner;

this.current = 0;

this.num = 0;

}

public int spin() {

int curr = 1 + (int) (Math.random() * spinner);

if (this.current == 0 || this.num == 0) {

this.current = 1;

this.num = curr;

return curr;

}

if (this.num == curr) {

this.current = this.current + 1;

return curr;

} else {

this.num = curr;

this.current = 1;

return curr;

}

}

public int currentRun() {

return this.current;

}

}

GameSpinnerTest.java

public class GameSpinnerTest {

public static void main(String[] args) {

// TODO Auto-generated method stub

GameSpinner g = new GameSpinner(4);

System.out.println("g.currentRun() : "+g.currentRun());

System.out.println("g.spin() : "+g.spin());

System.out.println("g.currentRun() : "+g.currentRun());

System.out.println("g.spin() : "+g.spin());

System.out.println("g.currentRun() : "+g.currentRun());

System.out.println("g.spin() : "+g.spin());

System.out.println("g.currentRun() : "+g.currentRun());

System.out.println("g.spin() : "+g.spin());

System.out.println("g.currentRun() : "+g.currentRun());

System.out.println("g.spin() : "+g.spin());

System.out.println("g.spin() : "+g.spin());

System.out.println("g.spin() : "+g.spin());

System.out.println("g.currentRun() : "+g.currentRun());

}

}

Output

g.currentRun() : 0

g.spin() : 1

g.currentRun() : 1

g.spin() : 4

g.currentRun() : 1

g.spin() : 4

g.currentRun() : 2

g.spin() : 3

g.currentRun() : 1

g.spin() : 3

g.spin() : 2

g.spin() : 2

g.currentRun() : 2

See more about JAVA at brainly.com/question/12975450

#SPJ1

This Question Involves The Creation And Use Of A Spinner To Generate Random Numbers In A Game. A Gamespinner
This Question Involves The Creation And Use Of A Spinner To Generate Random Numbers In A Game. A Gamespinner

Related Questions

Pls help I’m not trying to fail this

Answers

Answer:

B makes the most sense to me

Explanation:

Write a statement to declare a variable x with data type int and initialise with the value 10​

Answers

Answer:

int x = 10;

Explanation:

This would work in many languages (C/C++/C#/Java).

Larry has created a web page using HTML 4.01. He hasn’t included the declaration in the file. When he opens the page in a browser, Larry sees a page load error. Why does Larry need to use the declaration in an HTML file?
A.
to define the HTML version in which the page is written
B.
to define the web language in which the page is written
C.
to tell the browser what the content is
D.
to check whether the code is error-free

Answers

Answer:

To define the html version in which the page is written.

What is the best way to beat someone on starve.io? with a lava sword, or a pirate sword.

Answers

Answer:

Lava sword all the way

Explanation:

fo sho

Help me, I'll mark brainiest

Answers

Answer:

i believe the answers that you are looking for are c and c

Explanation:

again im not 100% sure that is right but i hope they are!

Mediante el contacto de las ruedas dentadas un engranaje transmite un movimiento a. Rectilíneo b. Circular c. Ondulatorio

Answers

Answer:

La respuesta es b: circular

Explanation:

Las ruedas dentadas tienen dientes que rodean a todo el perímetro de la rueda , esto logra que las ruedas dentadas entren en contacto entre ellas sin causar fricción,el movimiento que realizan es circular.

Please help!!
The following are two different images that are encoded using the same algorithm. The images are each in a 5 by 5 grid of pixels where each pixel is black, white, red, green or blue.

The image on the left gets encoded and compressed down to 21 digits while the image on the right gets compressed down to 25 digits. Although the same algorithm was used to encode and compress these images, why are the end results a different length?


The algorithm was probably used improperly in the image on the right, causing it to be a longer length than it should have been.

Because this is a lossy compression, sometimes information is lost during the compression.

The amount of size reduction from compression depends on the amount of redundancy in the original data.

The image on the right uses more colored squares and therefore requires more digits to represent the pixels.

Answers

Answer: The amount of size reduction from compression depends on the amount of redundancy in the original data.

The reason why the end results have a different length is because: C. The amount of size reduction from compression depends on the amount of redundancy in the original data.

What is a lossy compression?

A lossy compression is also referred to as irreversible compression and it can be defined as a type of data encoding (data compression algorithm) in which the data in a file such as an image, is removed by using inexact approximations, in order to reduce the amount of size of a file after decompression.

Since the same algorithm was used to encode and compress these images, the reason why the resulting images have a different length is simply because the amount of size reduction from compression depends on the amount of redundancy in the original image file (data).

Read more on lossy compression here: https://brainly.com/question/17542014

Whats the difference between Input and Output? Give and example of an example on a M:B​

Answers

Answer:

Entrar en algún lugar no es como irse de algún lugar, o qué tipo de pregunta significa para mi acción

How many decimals should we keep in electrical calculations?

Answers

Answer:

2 I think

Explanation:

Select the correct answer.
What model defines data structures and expands software architecture and components?
OA.
architectural design model
OB.
data design model
O c.
interface design model
D.
component-level design model
Reset
Next

Answers

Answer: data design model

Explanation:

Explain• Explain the Inputs and tools and techniques for determine budget with an example of London eye project and burj khalifa

Answers

Answer:

Cost baseline

Project funding requirements

Project resources

Updated project documents

Explanation:

London Eye project and Burj Khalifa are two of finest projects that have been successful in the world. The main reason for their success was well defined planning and accurate budgeting. The input and tools for budgeting are formulation of resource requirements. These resources are financial and human capital which is required to complete the project. The project resources allocation is a major point of concern. Inappropriately allocated resources progress towards failure of project.

characteristics of the printer​

Answers

Important printer characteristics include resolution, speed, color, and cache memory.

Which letter shows the ball when it has the maximum kinetic energy

Answers

Answer:

D.

Explanation:

Kinetic energy can be defined as an energy possessed by an object or body due to its motion.

Mathematically, kinetic energy is given by the formula;

[tex] K.E = \frac{1}{2}MV^{2}[/tex]

Where;

K.E represents kinetic energy measured in Joules. M represents mass measured in kilograms. V represents velocity measured in metres per seconds square.

Generally, when the final velocity at which a physical object moves is equal to zero (0), then it possess maximum kinetic energy.

Hence, the letter which shows the ball when it has the maximum kinetic energy in the graph attached is D.

How do “right to work” states impact workers? (Select all that apply.) They have strengthened unions. They have given unionized workers more protections. They have made it possible to fire workers for any reason or no reason, so long as they are not fired for federally prohibited reasons. They have increased dues-paying union membership by as much as two-thirds. They have banned union-security agreements.

Answers

Answer:

"Right-to-work" states impact workers through;

They have banned union-security agreements

Explanation:

"Right-to-work-laws" are state laws that ban union security agreements that allows the trade or labor union to demand employees of an establishment to join the trade or labor union including the obligation of the employer to collect union dues on the union's behalf to reduce the effect of the free-rider problem as the benefit of union negotiation benefits non-union members who are also employees

The "right-to-work laws" prohibits agreements between employers of labor and employees which are members of the unions from stipulating the requirement that the cost of union representation is to be payed for by the workers

What is the result of the following code fragment?
BigInteger a = new BigInteger ("10");
BigInteger b = new BigInteger ("25");
a.multiply(b);
a.add(b);
System.out.println(a);


A. 10
B. 35
C. 250
D. 275

Answers

Answer:

D

Explanation:

I don't know the language, but it is clear what is going on.

It looks like you are defining a value for a in both commands.

a.multiply(b); looks like you take the value in a (which is 10) multiply it by 25 and put the result back in a. So so far we have 10 * 25 = 250

Note the next command

a.add(b)

looks like you take the current value in a(which is now 250)

and put the value of b (which has not been changed. It is still 25) and put that in a (which is 250).

The result is 250 + 25 = 275

The answer is D. Since I only understand the logic, if this answer is wrong, I wish you'd leave a note.

what have very strong chemical bonds and cannot be reshaped when heated.​

Answers

Answer:

Thermosets

Explanation:

Which of the following is an example of a prediction:

Answers

Answer:

You need to include the examples so we can answer :)

Explanation:

To keep your computer working efficiently, it is a good idea to _____ unnecessary files. delete defragment save archive

Answers

Hey the answer to this is delete or remove. because it is a good idea to remove old files that your not using.

Hope this helps

-scav

Convert 1100 1001 to a decimal number.
Need help

Answers

Answer:

-28 and 1001 1010 = -26. Got to love. binary

Sam works in a real estate office. An offer comes in on a house but the homeowners are on vacation. He needs the homeowners to sign a document to accept the offer. What should Sam do?

Answers

Answer:

Sam should send a digital document and request a signature. The could be fax or even an image printed out, if neither is possible get in contact with eh owner and his lawyer for more help.

Explanation:

Answer:

Sam should call the homeowners’ cell phone to inform them of the offer and fax a copy of the document using the office fax machine. The homeowner should sign the document and fax it back. Sam may also conduct an Internet search to find the fax machine closest to the client.

Explanation:

got it right on edge

what can accommodate most file formats? btw there are no answer choices

Answers

Answer:.doc and .docx - Microsoft Word file.

.odt - OpenOffice Writer document file.

.pdf - PDF file.

.rtf - Rich Text Format.

.tex - A LaTeX document file.

.txt - Plain text file.

.wpd - WordPerfect documen

Explanation:

Reading a news release about a product is an example of
research.

Answers

Answer:

Yes, it is true, because it informs you

Explanation:

In a series circuit, resistance is?

Answers

Answer:

In a series circuit, the total resistance is equal to the sum of all resistances.

Explanation:

The same current passes through each resistor, so each resistor does its job as you would expect.

For Example:

a series circuit has a 2 Ω (ohm) resistor, a 5 Ω resistor, and a 7 Ω resistor. The total resistance of the circuit is 2 + 5 + 7 = 14 Ω.

PLS HELP ILL GIVE BRAINLY) enter the answer) desktop publishing software enables users to create products for print or __________ distribution

Answers

Answer:

Electronic

Explanation:

what is the meaning of HML​

Answers

Answer:

Explanation:

Hit my line

Which language gives instructions on how text should appear on a web page?
__Blank__ language gives instruction on how text should appear on a web page.

Answers

Answer:

HTML

HTML stands for HyperText Markup Language, so HTML gives you a way to “mark up” your text with tags that tell the browser how your text is structured.

Answer:

Markup language

Explanation:

HELLLP PLEASEEEEEEEEE

Answers

Answer:

torque

a twisting or turning force.

Hope it will help :)

PLS HELP
1. You can tape a movie off Showtime.
a. if you use it for educational purposes.
b. only if you have written permission from the company.
c. so that it may be archived.
d. to use as an entertainment for your great students.

2. You may photocopy parts of the encyclopedia:
a. if it is for your use only.
b. only if your copy is of the subject you are researching.
c. if you don’t have a copy at home.
d. to pass out to all your students.

3. You may record a local symphony concert to share with your class:
a. as long as you don’t sell tickets to hear it.
b. as long as you use it at a listening center in your room.
c. if you relate it to your lessons.
d. you may not record a public performance of any kind.

4. You may make a copy of a computer program:
a. if you are giving it to a friend.
b. as long as you purchased it and are using it for a back-up copy.
c. as long as you downloaded it from the internet.
d. you may not copy software.

5. You may use any image from the Internet or clip art software:
a. if you know that no one will know.
b. if you save it as an “image” and give it a new name.
c. as long as it is confirmed to be “royalty free”.
d. you cannot copy any photograph, artwork, or image without permission.

Answers

Answer:

1. so that it may be archived

2.to pass out to all your students

3.if you relate it to your lessons

4.as long as you've purchased it and you are using it for back up copy

5.C

How computer networking improve communication. ​

Answers

Answer:

Explanation:

How do computer networks communicate?

Networking computers can also help you improve communication, so that:

staff, suppliers and customers can share information and get in touch more easily.

your business can become more efficient - eg networked access to a common database can avoid the same data being keyed multiple times, saving time and preventing errors.

Which activity is performed during high-level design in the V-model?
A. gathering user requirements
B. understanding system design
C. understanding component interaction
D. evaluate individual components
E. design acceptance test cases

Answers

Answer:

B or E don't sure which one

Other Questions
Use the given points to answer parts 1, 2, and 3. Include all of your work in your final answer. Type your answer in the box provided or use the upload option to submit yoursolution.(6, 1) and (5, 4)Part 1: Find the slope of theline that passes through the given points, (6, 1) and (6,4).Part 2: Write the point-slope form of the line that passes through the points (6, 1) and (5, 4).Part 3: Write the slope-intercept form of the line that passes through the points (6, 1) and (5, 4). que caractersticas del cuento maravilloso estn presente en el cuento los tres cerditos What is a numerical expression? Give an example. create two stanza poem that will inspire the community to recognize the importance of categories of tropical cyclones. Give your poem a title What does the force between electric charges depend on In the Crucible, a portion of the play is written in prose. Miller calls it the "overture." Others refer to this as a. Single choice.(4 Points)ExpositionUsing ActionClimaxResolution what is the definition of assiduous? What current works best when the operatorencounters magnetic arc blow?DCEPACENCCAC House current is 120 volts. If a light bulb runs a current of 0.5 amps, what the resistance of the bulb? (Please please help!) Lee la pregunta y escoge la mejor respuesta. Read the question and choose the correct response.Cmo puedes cambiar la exposicin para escribir una leyenda original?A) Puedes cambiar el tiempo de la leyenda original a algo moderno o en el futuro.B) Puedes cambiar el conflicto que existe entre los personajes originales.C) Para cambiar la exposicin, puedes cambiar el final del cuento original.D) Para cambiar el desenlace, puedes cambiar el punto de vista de la trama. The price of a television is $567.31. The state sales tax rate is 8.3%.What is the total cost of the television? What's the purpose of the body's immune system?A To block pathogens from infecting the bodyB To fight off infectionsD All of the above is 3+5(9+2n)equal to48+5n A prehistoric site was discovered. The site is a nearly perfect circle Read the excerpt from Jungle Book: Mowgli's Brothers."Now," he said, "I will go to men. But first I must say farewell to my mother"; and he went to the cave where she lived with Father Wolf, and he cried on her coat, while the four cubs howled miserably."Ye will not forget me?" said Mowgli."Never while we can follow a trail," said the cubs. "Come to the foot of the hill when thou art a man, and we will talk to thee; and we will come into the crop-lands to play with thee by night.""Come soon!" said Father Wolf. "Oh, wise little Frog, come again soon; for we be old, thy mother and I.""Come soon," said Mother Wolf, "little naked son of mine; for, listen, child of man, I loved thee more than ever I loved my cubs."Which two themes are expressed in this excerpt?Money does not bring happiness.Followers are weak.Money does not bring happiness.Leaving home is painful.Followers are weak.Family relationships are strong.Family relationships are strong.Leaving home is painful. PLEASE HELP WILL MARK BRAINLIEST!!!Select all that are equivalent to sinGFH can someone help me find 2 political cartoons about the Cuban Missile Crisis? PLEASE! 1.What happened when some lost a case and still wanted to keep fighting?2.Were there any cases or courts that seemed harder to match than others? Why?3.What did all of the cases that made it to the Supreme Court have in common? Direction: choose the letter of the best answer 1. Which of the following groups would contain the largest number of organisms? a. Class b. family c. Genusd. Order 2. If two organisms are in the same phylum, they must also be in the same: a. Order b. Class c. species d. kingdom 3. These group of organisms can survive on extreme conditions a. Fungi b. Eubacteria c. Archaebacteria d. Anaerobic bacteria 4. Which of the following groups would be the smallest? a. Family b. Genus c. Species d. Order 5. Which of the following is NOT a characteristic of Eukaryotes? a. DNA in the nucleus b. Sexual reproduction is common c. Genome consists of few chromosomesd. Unicellular or multicellular Choose ALL the angles with a measure less that 90 degrees.