Question: how to write java program that simulates flipping a coin 100 times (head/tail needs to be generated randomly all 100 times) and display the total
how to write java program that simulates flipping a coin 100 times (head/tail needs to be generated randomly all 100 times) and display the total number of heads and tails at the end. Sample Output-1: Assume you are generating 5 random flips (tail, tail, tail, head, tail} Note - This is just an assumption for sample output. In your code you need to generate 100 times Result: Total number of Heads = 1 Total numner of Tails = 4 Sample Output-2: Assume you are generating 10 random flips {tail, tail, tail, head, tail, head, head, head, head, head} Note - This is just an assumption for sample output. In your code you need to generate 100 times Result: Total number of Heads = 6 Total numner of Tails = 4
Step by Step Solution
There are 3 Steps involved in it
Java import javautilRandom public class CoinFlipSimulator public static void mainString args Rand... View full answer
Get step-by-step solutions from verified subject matter experts
