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

PLEASE HELP!!! 20 POINTS REWARD!!! Here are two histograms of the same data but with different bin widths. Create one possible dot plot to represent both histog
From which 2 consecutive integers does the solution X^2 + 5x + 2 lie?
4. Determine the volume of 0.15 M CH3COOH and 0.12 M CH3COONa required to prepare 10 mL of pH 5.0 buffer. (Note: the pKa of CH3COOH =4.7)
Heyy everyone how yall doing act like it opposite day and say the opposite of ur answer lol :)
Find the equation of the line passing through the given point and parallel to the given line. ( -1 , -1 ), x + y = 8 ( -5 , -2), y + 3x = 10
Who is artist that painted this painting and what is the name?
I need some help please
why lilithium is nor stored in kerosene oil but wrapped with in peraffin wax​
The longest snake ever found was a python that was 10.0m long. Suppose a coordinate system large enough to measure the python's length is drawn on the ground. T
Kayden is a stunt driver. One time, during a gig where she escaped from a building about to explode(!), she drove at a constant speed to get to the safe zone th