Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C# Guidelines: You must use an array of ints to hold the histogram counts Do not use a switch or if statement to update

In C#

Guidelines: You must use an array of ints to hold the histogram counts Do not use a switch or if statement to update the counts in the histogram! In other words, you are not allowed to have code such as If (dieFace == 1) count1++; If (dieFace == 2) count2++

Part 1) Write a program to simulate a uniform integer random number (meaning every number is equally likely to appear as the next). Your program will be a Windows Form application which will simulate a 6-faced die. You will throw your simulated die N times. The number N should be obtained from the user via any appropriate control (it could be a textbox, for example) with a label stating How many rolls? Also, since you will be using the Random class you will have to use a seed number. This seed can be provided by the user, again by using an appropriate control on the form. The prompt can be as simple as "Please enter a seed:" Then use the seed provided by the user to seed the random number generator. This will also help you test your program. We will use 6000 times as an example. By default, your form should come up with a default seed of 123 and a default number of rolls of 6000. Show the frequency distribution of your numbers when 6,000 tosses are made and the random number is instantiated to generate numbers between 1 and 6 (inclusive). In other words, show how many times the numbers 1,2,3,.and 6 have appeared. The distribution must be displayed using a Chart control from the toolbox. The chart control is available under the Data section of the toolbox. Part 2) The second part of the project consists in displaying the sum of 2 dice. You will throw each of the 2 dice the same number of times (provided by the user) and display the sum of the faces displayed by the 2 dice. This will be done on a separate form. On the first form (displaying the distribution for 1 die) you will have a button that, when clicked, will bring up the 2nd form which will display the sum of 2 dice. That second form will have an input section to allow the user to select the number of times to throw the dice. There will be a button to start the experiment of throwing 2 dice and displaying their distribution. By default, your 2nd form should also come up with a default seed of 123 and a default number of rolls of 6000.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions