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

Can u paraphrase the quote ”let things take their course”
two identical freight cars roll without friction towards each other on a level track. one car rolls 2 m/s the other 1 m/s. after the cars collide they couple an
What is two thirds minus six thirds
What is Sir Francis Drake hardships
Does the depth of a pan affect how water freezes?
A 1 digit number and a 3 digit number have a sum of 205.  The same two number have a difference of 195, a product of 1,000 and a quotient of 40.  What are the t
is it possible for a distance versus-time graph to be a vertical line?
What two major processes are involved in the oxygen cycle?
A pound of seedless red grapes costs $2.75. Drew must spend less than $9.35 on a bunch of seedless red grapes.Inequality:Solution:Interpretation:
in what ways is climate controlled by the sun and the water cycle ?