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

The Middle Colonies were most known for its what of different religions?
Here is a sequence of shapes made from squares and circles. The sequence continues in the same way. The formula for the number of circles (c) in shape number (n
the process that removes metabolic waste products from an organism is known as
Which words in the sentence make up the appositive phrase? Mrs. Guerrero, the president of the historical society, is retiring next summer. A. Mrs. Guerrero
The sum of two numbers is 104 and one exceed the other by 10. What are the numbers?
what are the similarities between insects and humans
How many $0.21 pencils can be purchased for $7.00? Show your work.
how does art inspire some people
Solve each compound Inequality. 42. -2 ≤ d + 1/2 < 4 1/2 44. 2t ≤ -4 or 7t ≥ 49 46. -1 ≤ a - 3 ≤ 2 48. A town's high temperature for a given month is 88 degr
What Percent Of 700 Is 385