Question: (Intro to Java help?) Write a complete program that plays a coin flipping game, displays the individual flips, reports when a game is LOST or

(Intro to Java help?)

Write a complete program that plays a coin flipping game, displays the individual flips, reports when a game is LOST or WON and shows the number of flips needed to complete the game.

The algorithm is as follows:

Simulate the flip of a coin using a JAVA random number generator.

Flip the coin once to initialize the flip value and print out the flip

Inside of a loop, repeatedly flip the coin until 3 consecutive flips have the same value (3 heads or 3 tails)

Display the flip results after each flip

When the game ends, report the total number of flips

Note: you can use 0 for heads and 1 for tails, but if you have time, add another method that will convert the integers 0 and 1 to the characters H and T

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!