Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an application that will simulate a coin toss. Use the Math.random() funct

ID: 3930166 • Letter: W

Question

Write an application that will simulate a coin toss. Use the Math.random() function for the coin toss:

result = Math.random();

For the toss you may use the following criteria: if the result is 0.5 or less, the toss represents a head, otherwise it represents a tail.

Have a user input to determine how many tosses of the coin is desired. Generate the tosses and keep track of the number of heads and number of tails (do not display each toss). Display the percentage of heads and tails after the tosses are complete

Save the application as FlipCoin.java

Explanation / Answer

function flipCoin(){return Math.random()
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote