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

An animal shelter currently only has 30 dogs
PLS HELP! 10 POINTS!
how does latitude affect the temperature in an area
would anyone mind helping me out! thanks​
Ella S, Lily, Aziza, and Kevin earned a total of $100 shoveling snow. Each of them earned the same amount. How much did each of them earn? I will give 13 points
$2is what percent of $10
(b) Describe the characteristics of the interior of the aquaporin channel protein that allow water to flow through AND exclude glucose. If isolated keratinocyte
Eljah Muhammad, a leader of the Nation of Islam, promoted
mr. jaw needs 1 bag of sand for every 5 square feet of the sandpit. of bags of sand cost $8 each, about how much will mr. jaw spends on sand use ~ 3.14
A acrostic poem for prospero