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

I NEED HELP NOW!! PLEASE
What does the term 5p mean in the expression 5p - 10? which is multiplied by p. The ? 5 represents the ? the ?
i need help and you don't have to show your work
Help ASAP 3. Components in a heterogeneous mixture are not in the same phase or the composition of the mixture is a) uniform b) transparent c) uneven
Tu bois ____ eau.Vous ____ prenez frites.Marc prend ____ poisson et Marie prend _____ viande.​
What is the volume of the cone? (round to the nearest tenth)
Your company is estimated to make dividends payments of $2.1 next year, $3.6 the year after, and $4.2 in the year after that. The dividends will then grow at a
Find the slope for the line with points (2,4) and (3,6)
What is the equation of a line in slope intercept form that passes through the points (3 , 7) and (6 , 16)?
help me Its due today!!!!!!!!!!!!