The program simulates someone tossing a pair of coins some number of times, and displays the results in a graphical window. Initially your program will prompt for the number of trials to simulate (a trial is two coin tosses) on the console, error checking that a positive value is entered. This part of the program will be console-based. Then it will run the simulation and display a 500 tall by 800 wide pixel window with the results of that simulation. The results will consist of three labeled bars, each a different color, to show how many trials had the specified outcome. The label will show what the outcome was (e.g., Two Heads), the number of trials that had that result, and the percentage of trials that had that result (rounded to the nearest one percent). Because the simulation uses random coin tosses (simulated using a random-number generator) subsequent runs with the same input will produce different results.
kavishjadwani / coin-toss-simulator- Goto Github PK
View Code? Open in Web Editor NEWThe program simulates someone tossing a pair of coins some number of times, and displays the results in a graphical window.