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

how do fishing gears cause decrease in the population of marine species a) by changing water drifts b) by decreasing phytoplankton population c) by causing los
Lee la frase y escoge la forma correcta del verbo. Read the sentence and choose the correct verb form. Busco al hombre que conocí hace un mes y que ________ (sa
What is the purpose of having three separate branches of government and a system of checks and balances?
What is the easiest way to do the distributive property
help asapif x²-2x+y²+4y+5=0what is 2x+y??​
Increase 386.3 by 4%
Which statements describe the fossil record? Check all that apply. There is very little fossil evidence for the first 4 billion years of Earth. There is very li
2/5-1/4 simplified please help will make brainliest ​
A summary about the tree house
Photo attached please help