hajaghori hajaghori
  • 04-02-2021
  • Computers and Technology
contestada

write a method called threeHeads that repeatedly flips a coin until a coin

Respuesta :

hacker00100120
hacker00100120 hacker00100120
  • 04-02-2021

Answer:

public void threeHeads() {

Random r = new Random();

int count = 0;

while(count < 3) {

boolean head = r.nextBoolean();

if(head) {

System.out.print("H ");

count++;

} else {

System.out.print("T ");

count = 0;

}

}

System.out.println("\nThree heads in a row!");

}

Explanation:

Use GitHub

Answer Link

Otras preguntas

8. The governmental body responsible for interpreting the Constitution is the
What gas is removed from inhaled air
What makes a fish a fish
reflexions sur notre mode de vie actuel
the federalist papers were written by which future president
A drawer contains 2 red socks, 8 white socks, and 10 blue socks. Without looking, you draw out a sock and then draw a second sick WITHOUT RETURNING the first so
Who created the role of the cabinet?
Why does the atmospheric temperature increase with altitude in the stratosphere
if lines ab and cd are parallel which of the following statements are true
Compare and Contrast how sugar and salt dissolve into water differently.