Question
Write a C# app that simulates coin tossing. Write method Flip that simulates flipping a coin. Return true for heads and false for tails. Use
Write a C# app that simulates coin tossing. Write method Flip that simulates flipping a coin. Return true for heads and false for tails. Use this method in an app that asks the user how many times to flip the coin, flips the coin that number of times, and displays the result of each flip. At the end of the program, display the total number of heads and tails flipped.
NOTE: If the app realistically simulates coin tossing, each side of the coin should appear approximately half the time given enough flips. You may need to declare the Random variable as a global or class variable (or pass it into the Flip method as a parameter) so that it is initialized just once or else you may see some funny results. This is due to how the pseudo-random number generator works on a computer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started