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

PLZ HELP ASAP!!! Write 5^-3 in standard form
Name the stages of the plant life cycle:
how would i find h please help!!
Translate to mathematical symbols six divided into forty-eight
Mixed economies combine elements from A. mixed and market economies. B. market and command economies. C. market and traditional economies. D. traditional an
An octal number (that is, a number written in base 8), is a number written with digits from the set {1,2,3,4,5,6,7,8}. How many octal numbers of 11 digits are t
Let A be a finite, non-empty subset of R. Prove that A has a maximum and a minimum. (Recall that a maximum of a set A is an upper bound for the set that belongs
Which view of love (from “She walks in beauty” or “the river merchants wife:a letter”) appeals to you most? Why?
In my number, both digits are even numbers. The digit in the tens place is less than the digit in the ones place. The sum of the digits is 6.​
what is 292/410 in its lowest terms?