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

oceanic water circulation systems are termed - Upwellings -atolls -ebbs -gyres -pulses
how can i convert 5 kilometers to meters​
Steven buys 2.2 pounds of trail mix and twice as many pounds of mixed nuts. What is the total cost Trail mix- $3.50
allie scores 4 points in the first round of a card game in the next round, she loses 6 points then she scores 4 more points. EXPLAIN. (I WILL GIVE BRAINLIEST WI
Complete the conditional statement. If -2a > 6, then ______.
What is Achebe teaching?
In a scientific experiment, the_ changes in response to another change. O O A. hypothesis B. conclusion O O O C. dependent variable O D. independent variable
Write a compound inequality that is represented by the graph
Select the correct phrases. In Bogota: you can see the church San Ignacio you can visit the Gold Museum you can attend the flower fair you can go to the Botanic
help please !!!!!!!!