Question: Write a program that simulates a coin toss and determines if it is realistic. 1. For each toss of the coin, the program should print


Write a program that simulates a coin toss and determines if it is realistic. 1. For each toss of the coin, the program should print "Heads" or "Tails". 2. Prompt the user to enter the number of times the coins should be tossed. The coin should be tossed at least 10 times. Include an input validation statement to enforce this request. 3. Count the number of times each side of the coin appears. 4. Your program should call a separate function that takes no arguments, but returns 0 for heads and 1 for tails. 5. Format your output so that 10 tosses are printed per line. 6. Your program will call another function to determine if the simulation was realistic. This function will accept the number of heads (or the number of tails) and the number of tosses as arguments. a. If the selected side of the coin appears approximately half of the time, (between 45% and 55%) return true. Your code should print "This simulation was realistic." Otherwise, your code should print " This simulation was not realistic." Sample Output 1 Enter the number of times you want to toss the coin: 5 The number of tosses must be greater than 10. Re-enter: 50 Tails Tails Heads Heads Heads Tails Tails Tails Heads Tails Heads Heads Tails Heads Heads Heads Tails Tails Tails Heads Tails Heads Heads Heads Heads Tails Tails Heads Heads Heads Tails Tails Tails Tails Heads Tails Tails Tails Tails Heads Tails Heads Tails Tails Tails Tails Tails Tails Heads Heads The total number of Heads was 22 The total number of Tails was 28 This simulation is not realistic
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
