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

Angle 2 equals 130 find angle 3
Which of the following is NOT TRUE for both mitosis and meiosis?a they both preceded by interphaseb. they both split cells thru cytokinesisc. they divide accord
what is a topic sentence for youth crimes?
Which part of the atom does gamma radiation depend on? nucleus protons energy levels electrons
Which rule describes the translation ACD - A'B'CD? I
PLEASE HELP IM BEING TIMED
I need to know this question asap
If m = 80° and m = 30°, then m 1 =
Interpreting Velocity vs. Time Graphs Velocity vs Time Use the information presented in the graph to answer the questions, Which segments show acceleration? Whi
Explain in detail what the Harlem Renaissance was during the 1920s, give examples of this era's influence in today's society and culture.