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

Plz need help really fast will give brainlist IF CAN NO LINKS OR BIT WEBSITES OR FILES Jordan has 4/5 as many DVDs as Joseph. If Jordan has 56 DVDs, then how ma
This is Math but I still need help!!!!
How did Richard Nixon's action affect the outcome of the war, and American reactions to events?
A line is graphed on the coordinate plane. What is the slope of the given line?
please anyone who knows….
How did the scientific method impact the work of scientists beginning in the 16th century?a. It gave scientists a way to repeat others' work to make sure it was
NEED HELP ASAP PLEASE! Répondez aux questions par des phrases complètes. 1. Quel type de plantes, en particulier, peut-on trouver au bois de Vincennes? 2. Comme
What are the number of protons, electrons, and neutrons in one atom of neon? protons electrons neutrons
A square has an area of x^2-14x + 49cm2. What is the perimeter of the square?
What is the momentum of a 800kg car moving at 15m/s?