Welcome to Westonci.ca, where your questions are met with accurate answers from a community of experts and enthusiasts. Our platform connects you with professionals ready to provide precise answers to all your questions in various areas of expertise. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.

write a method called threeHeads that repeatedly flips a coin until a coin

Sagot :

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