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

Ashley’s Phone bill went from 32.25 to 18.70 what was the percent of decrease? Plz help a little confused...plz explain how you got the answer 22 points plz hel
2 1/4 is equal to what percent?
Help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! A square picture frame has a round circle cut out to show the picture. What is the area of the picture fr
simplify the rational expression 5x+15÷5x-15
Write the expression as a monomial in its standard form: 1.8p^15·(–p)^4 2.(-2x^2)^2*(-.25x^4) 3.((-.5)y^4)^3*(16y^2)
help pls it’s due tomorrow helpp
Simplify using i root -15 root -4
Please answer the following correctly!! Thanks so much!!
A number is divided by 4 and then 5 is added to the quotient.The final result is 1. Find the number a. 64 b.10 c.24 d.28
During the Constitutional convention, the Great Compromise was a result of arguments regarding which issue? A. The guarantee of protected individual rights B. H