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 oldest type of city goverment in america is __form -
What to the power of four equals 256
what is this answer I dont know most of it
What happens to any matter that is not used by consumers in a food chain?
The atomic number of krypton (Kr) is 36, and its mass number is 84. How many neutrons does it have? A) 18 B) 36 C) 48 D) 72
WILL UPVOTE I've been waiting 4 hours for help answering this. I need help The formula for rate is r=dt. Solve for d. Enter your answer in the box.
I really need a answer i am desperate, A, B, C, and D please.
Answer these Please I am begging u!
SOMEONE PLEASE HELP ME... I am confused on how to do this if you could explain a bit that would be helpful (you will get 15 points for answering this!) Questio
What is slope intercept form?