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

Bud not buddy what chapter is rule 63 on
Correlation does not equal ____. help please?
Add. (6v^2+6v+2)+(5v+7)
500/100 in simplest form
complete the sentence with the correct Spanish phrase; would you like me to tell you_?
I will mark as brainliest if you get correct
defined as a set of points equidistant from a given point
In “Nolan Bushnell,” which of the following descriptions best reflects how Bushnell’s first computer game was initially received? A: It was moderately received,
A properly adjusted safety belt
Spelling math science social studdies weekly and how to become smart and not get home work