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

write two different data sets with 6 numbers, so that: a) The mode is 100. The median and the mean are equal.
answer this question faster
Jane is 15 years older than Ganesh. She is four times as old as ganesh. Find their present ages
What color is the sky
A company had $6,992,000 in net income for the year. Its net sales were $15,200,000 for the same period. Calculate its profit margin.
WILL GIVE BRAINLIEST IF ANSWERED FAST!!!
What is the temperature of the triple-point of water on an absolute scale whose unit interval size is equal to that of the fahrenheit scale?
Why was the Soviet Union displeased with actions in West Germany? A. German soldiers were stationed on the Soviet border. B. Free and fair elections were held t
A model of a dinosaur skeleton was made using a scale of 1 in : 15 in in a museum. If the size of the dinosaur's tail in the model is 8 in, then find the actual
x / 6/7 =3 2/5 solve to find x please help