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

1 cup = 8 fluid ounces Does that mean it takes 24 fluid ounces of water to fill any 3 plastic cups?
Whole-exome sequencing identifies loci associated with blood cell traits and reveals a role for alternative gfi1b splice variants in human hematopoiesis?
1. Choose the correct graph of the given system of equations. y - 2x = -1 x + 3y = 4
Forgot to do this over winter break. Its due tomorrow and I haven't used my brain for 2 weeks. HELPPP (may have to zoom in)
If you made a stack of nickels 100 inches tall how many nickels how many nickels would you need
How does being underground affect Persephone?
The molar mass of magnesium (Mg) is 24.30 g/mol. There are 6.02x10 atoms in 1 mol.
Treaty of versailles how did it impact germany and the other nations qyuizlet
Eran las cinco de la tarde. Correctly or incorrectly written?
How much greater is 300 than 3