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

Graph the linear function passing through point B with a slope of -2
Pls help with this one question
Suppose, one of your friend is regularly taking alcohol. What will you do to protect your friend from alcoholism? write in 8 points​
Need help asap please show work
What can the Science Museum teach you
please help i do not understand this
HIGHSCHOOL GEOMETRYLAWS OF COS/SINplease helpit also says that it is acute, and I dont know how to factor that into my answer​
What is the first operation to use to simplify the expression? ​ 3,500 divided ( 34 + 8 + 2) - 4 a. add b. subtract c. multiply d. divided
Forme, pelo menos, 8 frases com as palavras (nomes: adjetivo, substantivo e advérbio) acima, verifique o uso da crase.
"I write good music with an exclamation point"! Declared composor Richard Wagner.correct any errors in capitalization or punctuation.PLS IF YOU DO A FAKE RESPON