Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a static method named threeHeads that repeatedly flips a coin until three heads in a row are seen. You should use a Random object
Write a static method named threeHeads that repeatedly flips a coin until three heads in a row are seen. You should use a Random object to give an equal chance to a head or a tail appearing. Each time the coin is flipped, what is seen is displayed (H for heads, T for tails). When 3 heads in a row are flipped a congratulatory message is printed. Here are possible outputs of two calls to threeBleads TTTHTHHH Three heads in a row THTH T T TTTHHTHHH Three heads in a row
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started