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 me show the working please with the correct answer
What country did not belong to the Western world during the Cold War? a) East Germany b) Austria c) Turkey d) Italy
If the circumference of a circle is 64 inches, what is the diameter of the circle (to the nearest whole number) use 3.14 for pi
Which of the following is NOT true about the Gettysburg Address? A) It eloquently made the point that the dead should not have died in the vain. B) It contains
Can someone answer this I need to find the surface area
Pls help me guys this is super hard
Write the equations included in the same set of related facts as 6x8=48
Which star color indicates the hottest star in the surface
HELP!! T.T This is due tonight!!!
plz help me and show the wurking