Page 1 of 1

Need help writing a C# code that requires a dice roll. Here is the desired output:

Posted: Fri Jul 08, 2022 6:15 am
by answerhappygod
Need help writing a C# code that requires a dice roll.
Need Help Writing A C Code That Requires A Dice Roll Here Is The Desired Output 1
Need Help Writing A C Code That Requires A Dice Roll Here Is The Desired Output 1 (108.35 KiB) Viewed 33 times
Here is the desired output:
Need Help Writing A C Code That Requires A Dice Roll Here Is The Desired Output 2
Need Help Writing A C Code That Requires A Dice Roll Here Is The Desired Output 2 (40.19 KiB) Viewed 33 times
PROGRAMMING: DICE ANALYTICS ASSIGNMENT INSTRUCTIONS OVERVIEW Adapted from: Deitel & Deitel (2017). Visual C# 2015 How to Program (6th ed.). Pearson Education, Inc. Write an application to simulate the rolling of two dice. The app should use an object of class Random one to the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer from 1 to 6, so the sum of the values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 the least frequent sums. Your application should roll the dice 36,000 times. Use a one-dimensional array to tally the number of times each possible sum appears. Display the results in tabular format. Determine whether or the totals are reasonable (e.g., there are six ways to roll a 7, so approximately one- sixth of the rolls should be 7). INSTRUCTIONS In the Main() method, you will declare an integer array to hold the tally of the rolls. Use the Random class to generate a random number between 1 and 6 for each of the die rolls. Using a FOR loop, iterate 36,000 times to make the two die rolls, sum the results, then increase the count of the correct element in the array to record the result. (HINT: The array being used here WILL NOT be 36,000 elements long. It will only have a length of 10) Using another FOR loop, print the results of roll counts contained in the array to the screen in two columns with headers. The first column will hold all the possible rolls of the two dice, with the count of how many times that roll combination was achieved in the second column. When using the loop to print the results array, use the GetUpperBounds() method to determine how many times to loop. DO NOT assume that you will always get an array of length 10. Make the code smart enough to figure out how many times to loop no matter what the length of the array.
Your output should resemble the example below: C:\Users\jasonchristian source\repos\ConsoleApp4\ConsoleApp4\bin\Debug\ConsoleApp4.exe Role 4 5 Count 995 1937 3100 4120 4982 5929 5043 3934 2986 1995 979 9 10 11 12 Press any key to continue... X