CSIS 209 Programming Assignment 3

Availability: In stock

Regular Price: $10.00

Special Price: $8.00

OR

CSIS 209 Programming Assignment 3 Code

Double click on above image to view full picture

Zoom Out
Zoom In

More Views

Quick Overview

CSIS 209 Programming Assignment 3


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 frequest sum and 2 and 12 the least frequest 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).


Requirements:
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.

Regular Price: $10.00

Special Price: $8.00

Details

CSIS 209 Programming Assignment 3

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 frequest sum and 2 and 12 the least frequest 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).

Requirements:
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.

Product Tags

Use spaces to separate tags. Use single quotes (') for phrases.