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

I need some help. This is due today. Please
solve the equation. (show step by step)(a + 6)(3a - 7) = 0
Help with maths question please
how to tell when to use sin, cos or tan​
Simplify.(x−3)(x2−4x−7)(PIC)​
When a molecule of double-stranded DNA undergoes replication, it results in A) three double-stranded DNA molecules, each composed of section of old strands of D
i need to find the surface area of the cube
What did president thomos jefferson’s foreign policy to deal with this problem
I learned in anatomy class that the adult human body contains 206 bones, and over (20, twenty) of them are located in the hand alone.
Mario’s younger brother is 2 3/4 tall. Mario is 1 3/4 feet taller than his younger brother. Which number line represents Mario’s height, in feet?