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

I need help please thanks
What is the area of the parallelogram?
. Read the passage. The time was in the 1720s. Colonists were living in South Carolina. They petitioned England. They wanted forts built to their south. What i
Examine all of the different kinds of information that Lewis and Clark brought back with them. Explain how this information created an important body of knowled
What Is 7 Rounded To The Nearest Tenth?
After the climax of a story, what should the reader expect next?
Representa una funcion cuadratica con las siguientes caracteristicas a: vertice en (2,-4)y b: puntos de corte con el eje x(-2,0)y (g,0)
Who is the author of “The Monkey’s Paw”? O. Henry W.W. Jacobs Guy de Maupassant Jack London
Cuando yo era niña, yo ________(vivir) en Argentina
In a research study if one variable is changed to se how it affects behavior the study is most likely an