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

How did scientific revolution contrast with the idea of gothic genre?
When compiling your list of references you should include _____. a. the name, title, and contact information for each b. a short summary of their work history c
BRAINLY Which of the following is true about repetition in an experiment? It involves setting up of a hypothesis. It involves multiple trials. It involves d
Which functional group allows the sugar glucose to dissolve in blood?
Read the following stanza from Shakespeare's "As You Like It": All the world's a stage, and all the men and women merely players; They have their exits and the
What is a video projector used for? A. playing video tapes B. scanning documents into a computer C. projecting a computer image on to a screen D. filming video
What 2 STIs cannot be cured and can always be passed to someone else, even if you do not have symptoms
News standards require journalists to be objective in order to:
What is the measure of angle B in the triangle? Enter your answer in the box.
Can someone solve this for me? Thanks.