Put the whole program in a loop so that after the coin is


Java (math.random)

Need to code program to simulate a coin toss

Ask user to call the coin toss (h or t): (scanner)

print Tossing...

print The coin came up (heads or tails). You win if matching or You lose if not!

1. Allow any variation of h,heads, Heads, HEADS for input. Same for tails.

2. Put the Whole program in a loop so that after the coin is tossed and reported, the user is asked if they want to play again.

3. Keep track of the number of wins the user has. When user decides to quit, report their success rate (%correct).

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Put the whole program in a loop so that after the coin is
Reference No:- TGS02477801

Now Priced at $15 (50% Discount)

Recommended (99%)

Rated (4.3/5)