Question: #1321

PROG 110 Homework 8 The Roll of the Dice and More Array Manipulations Complete Solution

PROG 110 Homework 8 The Roll of the Dice and More Array Manipulations


Due: See Calendar
Use Assignment Tool
Points Possible: 15
Objective: A customer at Quark’s Bar & Restaurant located on the Promenade deck of Deep Space Nine (aka Terok Nor), complains that the house is always winning his latinum when playing a local dice game. Quark explains that the odds are always in favor of the house, and quoted from the Ferengi Rules of Acquisition, #1 Once you have their money ... never give it back. You are to create an application that will simulate the roll of two dice and show that their sum can affect the odds of winning (or losing in this case).


Application Specification:
On the next page, you will see an example of the information to display. The data will vary since you will be using the random number generator.
Solution Name: yourLastNameDiceHW8
Project Name: yourLastNameHW8
Source File Name: Dice.cs, Class Name: Dice


Application Specifications and Requirements:
1. Introduce the user to the program – what is the purpose – make it your application and be creative! I don’t want to see “To use the random number generator to populate a 2D arrays, using nested for loops because it is required for the assignment” or something similar. Also specify the number of rolls that will be used in the program.


2. The application is to use an object of class Random once to roll the first die and again to roll the second die. Use variables to store the values.


3. The sum of the two values are then to be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12.


4. The application is to roll the dice 36,000 times. Use a determinate looping construct and use constants where applicable. In other words, when you want to use the value (literal) that has been declared a constant, use the constant variable. HINT: 1, 6, 36,000 what do they represent, and will they change? You may also use a constant named ARRAY_SIZE and assign it a value.


5. Use a one-dimensional array to tally the number of times each possible sum appears.
6. Display the results in a tabular format using the Length property of the array to control the looping construct. This will then make it a determinate loop.
7. Display the tally values with commas
8. Let the user know when the program has ended, what to do next, and include your name as the application’s creator.
9. Follow efficient programming techniques.

Requirements:
1. Make sure to include the file block comments and internal documentation. After running your program a few times, clearly note in the file block comments the answer to fhe following questions: In your program, which two totals are rolled the least? Which one total is rolled
the most often? Why does this occur?
2. Delcare all local variables at the beginning of the method.
3. I will change the value of the constant that controls the number of times the dice are “rolled”, and your program should work and not have any run-time nor logic errors. You can test this yourself by changing the value to 100, 500, etc.
Review the Software Development Standards (SDS) for implementing the required documentation, naming conventions, UI, indentation of the loops, and other details.
Example of the output:

Challenge:
Sort the array in your choice of ascending or descending tally results and display it on the screen
To be submitted:
1. The complete Visual Studio solution you developed.
Submit all files in one Zip file named yourLastNameHW8 (e.g. SmithHW8.zip).
The zip file hierarchy will look like the following:
SmithHW8.zip
SmithDiceHW8 <folder>
It is your responsibility to ensure that all files are submitted and that I don’t receive a “shortcut”, or missing a file. If I don’t have the correct files, I cannot grade your project and therefore, you will receive a zero for the assignment.
If you have questions, please post in the appropriate category/topic, but do not post any actual code. In answering another student’s question, do not post actual code, but you may provide guidelines/hints on how to obtain the desired result.

Solution: #1301

PROG 110 Homework 8 The Roll of the Dice and More Array Manipulations Complete Solution

This Tutorial is rated A+ previously,if...

Tutormaster
Rating: A+ Purchased: 11 x Posted By: Vikas
Comments
Posted by: Vikas

Online Users