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

is the underlined verb in the sentence a linking verb or an action verb? i bought some books at the yard sale yesterday. a. action verb b. linking verb
what type of verb is the underlined word in the sentence? the reporter writes daily for the newspaper. a. transitive b. intransitive
for work to be accomplished we must have (2 points) a)an action which causes movement and an opposite reaction. b)an action which causes no movement or reaction
what was one consequence of the slump in tobacco prices in the 1660s?
which policies would have received the most support from georgia's "malcontents"? a) policies that would allow trade with the spanish in st. augustine. b) polic
what best describes a firewall
What are Gastropods
A body was found at 6 a.m. outdoors on a day when the temperature was 50oF. The medical examiner found the temperature of the body to be 66oF. What was the appr
How many tens are in 30 ones?
what is necessary for a convection cell to be set up in a fluid? a. thermal gradient b. changes in density c. thermal gradient and changes in density