Question: 3. (30 points) Write a class called Three Heads that repeatedly flips a coin until the results of the coin toss are three heads in

 3. (30 points) Write a class called Three Heads that repeatedly

3. (30 points) Write a class called Three Heads that repeatedly flips a coin until the results of the coin toss are three heads in a row. You should use a Random object to make it equally likely that a head or a tail will appear. Each time the coin is flipped, display H for heads or T for tails. When three heads in a row are flipped, the method should print a congratulatory message and number of flips. You must use a do-while loop. Here is a possible output of your program: TIHTITHTHTHHH Three heads in a row after 13 flips

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!