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

Solve the equation log 6x - 3 = -4
The shape of the clock is a regular dodecagon with a radius of 14cm. Centered on the clock's face is a green circle of radius 9cm. If the region outside the cir
which of the following organisms feeds on the largest variety of producers
Three individuals form a partnership and agree too divide the profits equally. X invest -9,000 , Y invest 7,000, Z invest 4,000. How much less does X receive if
what derived unit is usually used to express the density of liquids?
What metric unit should i use to measure the mass of a monkey
What is 574 in expanded form
which is longer 635 millimeters or 535 centimeters ?
What is 0.8% written as a decimal
Sound: The more _______ a sound has, the _________ its volume is.