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 Motherboard Components?​
Find t′(x) from t(x)=√(−3x−7) using the definition of a derivative.
PLSSS HELP IF YOU TURLY KNOW THISS
A surgeon has found that she can model the number of surgeries done per week with a Poisson distribution in which μ= 20.9. How many surgeries would be expected
"What are you burning to tell the world?" This is going to be as unique as you are. I have no idea what drives you, what makes you feel alive and engaged, but h
(4y+3)-(y-2) Find the sum or difference.
The perimeter of a square window is 148 inches. How long is each side?
Nicole and Elena wanted to know if listening to music at a louder volume negatively impacts test performance. To investigate, they recruited 30 volunteers and r
1. One liter is equal to 1,000 milliliters. How many liters are equal to 18,045 milliliters?
Evaluate the expression 6(x) when x equals 3. Pls... I need help.