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

a golbet contains 3 red balls, 2 green balls, and 6 blue balls
Pumping stations deliver oil at the rate modeled by the function D, given by d of t equals the quotient of 5 times t and the quantity 1 plus 3 times t with t me
The economies of Norden could be described as__? A) dependent on one product B) healthy and diverse C) unable to use rich resources D) struggling but divers
The treaty that ended World War I but was rejected by the U.S. Senate was called the treaty of
a certain isotope decays so that the amount A remaining after t years is given by: A=A0 x e^-0.03t, where A0 is the original amount of the isotope. to the neare
solve by factoring square roots x^2 -49=0​
which type of government selects it’s executive leadership from the majority party in the legislature? A. unitary B. federal C. confederal D. parliamentary
what is a set of javascript statements that result in an action?a. alert boxb. comparison c. syntaxd. function​
need help with number 29
What was one cause of the French and Indian war?