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

In the passage, what causes the conflict between the narrator and his friends? A The narrator secretly despises his friends for their mean-spirited pranks, and
Which statement describes function composition with respect to the commutative property? Given f(x) = x² – 4 and g(x) = x – 3, (f ∘ g)(2) = –3 and (g ∘ f)(2) =
Solve for x: 3x+2=11
Which of the following is NOT one of the defining characteristics of a minority group? A pattern of disadvantage or inequality Visible identifying traits or cha
I’ll give brilliant if answered
carry out this problem 2.4g/mlx15.82ml
You are configuring two PCs for your network, PC-A is given an IP address of 192.168.1.18 and PC-B is given an IP address of 192.168.1.33. Both PCs receivces a
what is the answer to 1.58x1.78=
What is a Poll tax, Literacy test, and Grandfather Clause? (Please answer as soon as possible)
why does the tree become a tourist attraction?