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

Marty is very spontaneous and somewhat unorganized. Initially, he thinks very positively of his wife's tendency to be organized and plan. However, four years in
Which angle had a positive measure?
solve , 27% of 100 please ASAP , otherwise I will fail​
What is the additive inverse of 1.001
Mai runs each lap in 7 minutes. She will run less then 84 minutes today. What are possible numbers of laps she will run today?
የለዳማ ብሔሮች ብሔረሰቦፍ ዓአኗኗር ዘዔቤ tell me ok​
please please please please please please​
Mr. Gonzales has made beginning-of-year deposits into an investment account for the past 21 years. Each deposit was $5500, and the account earned interest at a
ILL MAKE YOU BRANLIEST Answer choices- F- 4/h = 20/6 G- 4/16 = h/6 H- 6/4 = 20/h J- 6/4 = h/20
Como usar el teorema de tales para sacar x