Question: WIGULUSLUUPLIUI You will write a program using functions that performs the following tasks. These tasks are explained in more detail later in this document (1)



WIGULUSLUUPLIUI You will write a program using functions that performs the following tasks. These tasks are explained in more detail later in this document (1) For a user specified number of iterations, determine an approximation for pi using the Monte Carlo Method. Set the output precision to 6 decimal places for this part of the program. (2) Determine the outcome of a fair coin being flipped. For a user specified number of coin flips, determine the percent of the time that heads comes up and the percent of the time tails comes up. Set the output precision to 4 decimal places for this part. (3) Determine the outcome of a fair 4-sided die being rolled. For a user specified number of rolls, determine the percent of the time that each side (sides 1.2.3 and 4) come up. Set the output precision to 4 decimal places for this part. "fair - means that each possible outcome is equally likely - there is no bias for one outcome over the others. For the coin it means that heads has a 50% chance of coming up and so does tails. In order to perform the above tasks, a random number generator is to be used to determine values for testing. Information regarding the random number generator occurs later in this document. To perform the above tasks, your program should have the following order (pseudo algorithm/functional decomposition setup) as illustrated in the sample solution: Prompt the user for a seed value for the random number generator and use it to initialize the generator Write out a menu with the choices as shown in the sample solution and obtain the selection value While the choice is not to exit, perform the following loop For choice 1. generate random numbers and process to determine the approximation for pl For choice 2, generate random numbers and process to determine the fair coin probabilities For choice 3, generate random numbers and process to determine the fair die probabilities Write out a menu for the next choice and obtain the selection value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
