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

Which type of person was most likely to be considered a witch?
(69 points!) Some1 please solve. (69 points!)
Before the French Revolution the people of France were divided into three estates based mainly on their ... A: education level B: geographic C: social class D:
One amu is equal to the mass of an electron the mass of one proton or one electron the mass of one neutron or one electron the mass of one neutro
When ashley tells jeremy, "i am going to study really hard for that history test," and jeremy replies, "i know you will. you have a real drive to do well in sch
16/2*4 solve for answer
John muir helped to found yellowstone national park in california in the late 1800s. a. True b. False
Which sentence has correct capitalization? A. Barry Crouched down below his desk and whispered to Rob, "These emergency action drills sure are uncomforta
What is the domain and the range of the relation represented by the ordered pairs? {(2,3),(−2,4),(1,6),(0,4)} Select each correct answer. domain: {−2,0,
What is a disadvantage and advantage for Electrical Energy??