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

Please help! I will give Brainiest for correct answer! Select the correct location on the image. Choose the empire united by a common religion and a common lan
Please I literally hate Spanish
9x-5x=24 x= I need a answer ASP!!!
PLZ HELP ME NOW FOR THIS TEST The excerpt below was written by Henry Stimson in 1941: The atomic bomb was more than a weapon of terrible destruction, it was a
which land did united states took from mexico in alamo
What are the properties of fourth matter plasma?
describe a second degree burn ​
What is the output of this program? Assume the user enters 2, 5, and 10. numA = 0 for count in range(3): answer = input ("Enter a number: ") fltAnswer = float(a
There are 96 dogs at the dog park. 1/8 of the dogs are brown 5/6 of the dogs are black. The rest are mixed colors. In this park how many dogs are mixed colors?
2. Convert 24 pesos to U.S. dollars.