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

is it bad being blind
what is the theoretical probability of selecting a heart or a spade from a standard deck of cards
First aid procedures are used for precautionary or preventative measures. true false
What is the life cycle of a eukaryotic cell called?
What force causes a rolling ball to slow down and stop
Solve for B CORRECT ANSWER PLS
The seventh-grade class is building target areas for a PE activity. The bases for the game will be in a circular shape. The diameter of each circle is 3 feet. A
The radius of a wheel is 7cm. how many revolutions will it make if it travels 44 km?
how do you do fractions on a number line
I'm having trouble finding the answers. I've read the text over a dozen times. Please help!