Question: Write an excel vba program that simulates the rolling of two dice. The output from this program is shown below. The user enters the total
Write an excel vba program that simulates the rolling of two dice. The output from this program is shown below. The user enters the total number of simulated rolls into the spreadsheet (in the indicated cell). In the figure below, there will be 100,000 simulated rolls. When the Run button is pressed, your program will simulate the user entered number die rolls. The outcome of each roll is an integer in the range of 2 to 12. For each roll, the outcome (2 12) is recorded and the total number of times for each outcome is stored in an array. This data is output to the Number column. For instance, the number 7 results in 17941 of the 100,000 rolls in the example below. The pct column records the percentage that each number results (of which 7 was 17.94% of the 100,000 rolls. The percentage data is stored in another array. Once the rolls have been simulated and the Number and Percentage arrays have been filled, output the data to the spreadsheet in the manner displayed in the figure. The Clear button will clear the data from the Number and pct. Column headings as well as the data in the Roll column does not need to be input by the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
