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

What example does Wiesel give to show how the United States acted to end human suffering? A. The U.S. pledge to support Israel B. America's hunt for war crimina
A snail moves 18 millimeters every 24 seconds what is the snails rate of speed
A client with severe crohn's disease develops a small bowel obstruction. which clinical finding should the nurse expect the client to report?
Network behavior analysis system __________ sensors are typically intended for network perimeter use, so they would be deployed in close proximity to the perime
Which is the inverse of the function f(x)=1/3x+5 ? A) y=1/3x-5/3 B) y=3(x-5) C) y=3x-5 D) y=1/3x+5
Question 42 and 43 I need help
which of these restrictions contributed to excluding both women and slaves from the civil participation in the 18th and 19th centuries?
Explain how money and Supreme Court rulings shifted power to the federal government
Name a pair of vertical angles
The number of hours a typical student spends per week at school has an Order of Magnitude of 1. true or false