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

Which model is directed solely at determining how much input subordinates should have in the decision-making process?
jewish beliefs were that a chosen one has been foretold and was destined to be born on earth. they called this figure the:
From the buyers point of view the best quality is
(a) if x is the sample mean young's modulus for a random sample of n = 64 sheets, where is the sampling distribution of x centered, and what is the standard dev
Explain why a glucose test strip may be used to determine the enzymatic activity of lactase
Can I be a Worker and Employer at the same time?
All other factos being equal,which type of compounding will generate the most interest?
The condition of acidosis can cause ____________ because the higher h concentration diffuses to the icf, pushing k towards the ecf
In what percentage of such groups (of 400) would 150 or fewer improve? round your answer to one decimal place
How long can it take for the body to process the alcohol in one standard drink (0. 6 ounces)? 2 hours 1. 5 hours 1 hour 30 minutes