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

Determine whether the sequence below is a geometric sequence and, if so, find a formula that describes the sequence. 2, 4, 8, 16, –32, 64, … A. 2003-20-0
Which of these words conveys a negative connotation? a. consider b. explain c. discuss d. dispute
The _____ are responsible for linking amino acids together. a. centrioles b. ribosomes c. lysosomes d. vacuoles
Given the expression: 5th + 6b + 7c.Sendo a = 1, b = c = -7 and 10.What the numerical value of the given expressõa?
The ultimate resource of a firm is its a. business plan b. marketing mix c. capital budget d. employees
by urging the creation of a league of nations and u.s. membership in it, president woodrow wilson was proposing that the united states abandon its old policy of
How did people most likely arrive in northern europe
what is the mode of the data values: 54,78,26,36,26
The is the center of the solar system.
The circumference of a planet is about 23,000 miles. Find its diameter to the nearest mile.