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

true or false the american revolution was fought by the american colonies and china??
This watery vacation spot is considered part of both California and Nevada. Name this lake
The heads of which presidents are carved into Mount Rushmore?
The numerical factor of a term. In 5x, the 5 is the coefficient. Identities Origin Exponent Coefficient
The last new star was added to the American flag in which year?
power set of {e,f,m,n,o}
In what city will you find NASA’s headquarters for all piloted U.S. space projects?
What other countries celebrate the 4th of July?
What historical event do Americans celebrate on the Fourth of July? 1.Official signing of the Declaration of Independence 2.George Washington's birthday 3.The f
Name the singer/songwriter of “On the 4th of July.”