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

whats the squareroot of 72 needs to be simplified
For what values of x is the value of the function f(x)=x² +3x+2 equal to zero?
tolong donk cari apa jawabannya ​
What is the verb? A. Went/Did succeed B. Didn't succeed C. To work
please help me i need help
Purple Panda Products Inc. is considering a project that will require $650,000 in assets. The project will be financed with 100% equity. The company faces a tax
Who was General Cornwallis and why was he important?
Helppppp thxxxxxxxxxx
If a stock has a preemptive right, it gives current stockholders the right to purchase any new shares issued by the firm, so as to maintain their level of owner
6th grade math. :) help me please