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

How was the rise of caudillos in the Latin American countryside a result of independence movements? Caudillos controlled areas where weak revolutionary governme
Through the 20th century and continuing today, the nature of federalism has changed over time with new demands that have tended toward a system where the state
As a result of the election of 1876, which person brought Reconstruction to an end in 1877? Edwin M. Stanton Rutherford B. Hayes Thaddeus Stevens Ignatius Donne
Which of the following is considered a xanthine? a. Acetylcysteine b. Guaifenesin c. Theophylline d. Epinephrine HCL
What were two main focus of the Reagan administration?
what is the difference between heterogeneous mixture vs homogenous mixture
If n=2, and l=0, then what are the possible values of ml?
what is the difference between heterogeneous mixture vs homogenous mixture
What did the Social Security Act and the Work Progress Administration have in common regarding employment for young people? They gave younger workers more right
A shared characteristic that all civilizations have is that people _