Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# Arrays Plan of Attack 1. For each of the two assignments, create an individual VS solution 2. Make sure you understand what is required

C# Arrays
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Plan of Attack 1. For each of the two assignments, create an individual VS solution 2. Make sure you understand what is required for this assignment! This is just like the real world: if there is ambiguity, it's up to you to resolve it. Review the materials carefully and ask clarifying questions when needed. 3. Plan and estimate your work, but this assignment does not require you to submit a time sheet with your solution. 4. Build pseudocode or a flowchart to help you work out the logic. 5. Write down a set of test cases that will help you to ferret out logic problems and ensure that your code is working 6. Code, test and debug using your test cases. And remember: Do not use goto, break (except in a switch statement) or continue. Do not use return or Environment.Exit() Do not use variables of type var. Do not include any commented-out code in your submission. Remove all unnecessary using statements. General requirements for each simulation: The program must behave as described in the spec. The program must execute without any exceptions (i.e., run-time errors). There must be no warnings. The code must conform to the course Software Development Standards in all other respects, including comments. Numeric values must be right-justified and appropriately formatted. Happy coding! Specifications start on the next page. 2 Homework 4.1 - Yosemite Sam Dice simulator (20 of 60 points) Specification Yosemite Sam, owner of the Rising Gorge Saloon, is considering introducing gaming to his establishment. To determine how the house can win at dice games, he wants to understand the probabilities associated with hitting a specific number when rolling two dice. He has contracted with ACME Industries Simulation Division to create a dice rolling simulator. The simulator is to work as follows: Display a nice banner explaining the simulation in brief. Read a value from the user that tells how many times to roll the dice. Any positive whole number is acceptable. If the user enters a non-numeric value or non-positive value, use the default number of rolls: 100,000. Simulate rolling two dice using the Random class the number of times specified. Tally how many times each possible combination of pips appears. Note that each die has values 1 through 6, so the possible number of pips runs from 2 to 12, inclusive. At the end of the simulation, print the following: A table of results. For each row, print two columns The number rolled (2-12), and A count of times that number is rolled. Accumulate the total number of rolls and print it as a total row. This is a check to ensure the correct number of rolls was executed. 3 For full credit... Naming Submit your program as a .cs file named DiceSimulator.cs. Mine would be "MiniumDice Simulator.cs." Required coding features and hints Represent the default number of rolls as a constant. Use the Random class for each roll. Use a single one-dimensional array with 11 elements to hold the count of each roll value (2-12). Challenge yourself. Bonus features for Homework 4.1 1. At the end of each simulation, ask the user whether they would like to run another simulation. If they do, start back at the top asking how many simulated rolls, etc. Note: don't forget to reset the array 2. Add a column that shows the percentage of rolls for each possible combination. Add up the percentages so that in the Total row at the bottom, you can prove that the percentages add up to 100% a. Use the Percent format character to print each percentage. b. Print each percentage with two decimal places (eg, 13.45%). c. For the Total percentage value, show the percentage with NO decimal places. 4 Sample output for Homework 4.1 - full credit In the example interaction below, data typed by the user appears highlighted and in boldface. ACME Industries Simulation Division ****** Dice Rolling Simulation v. 1.1 One row per possible roll of two dice How many rolls would you like to simulate? >>100000 Roll Count 2 2,868 3 5,595 4 8,341 5 18,982 6 13,868 7 16.712 8 13,843 9 10,984 8,365 5,588 12 2,854 100,000 sa 11 Press any key... Sample output for Homework 4.1 with bonus features In the example interaction below, data typed by the user appears highlighted and in boldface. ACME Industries Simulation Division Dice Rolling Simulation v. 1.1 One row per possible roll of two dice Including bonus features!! . How many rolls would you like to simulate? >> 1000000 Roll Count Pct 2 27,991 2.80 % 3 55,706 5.57 83,397 8.34 % 5 110,983 11.10 % 6 139,093 13.91% 7 166,142 16.61 % 8 139,420 13.94 % 9 110,651 11.07% 10 83,771 11 55,111 5.51 % 12 27,735 2.77 % 1,800,00 100 % To run another simulation, enter":n 5

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

7. What are the main provisions of the FMLA?pg 87

Answered: 1 week ago

Question

1. How do most insects respire ?

Answered: 1 week ago

Question

Who is known as the father of the indian constitution?

Answered: 1 week ago

Question

1.explain evaporation ?

Answered: 1 week ago

Question

Who was the first woman prime minister of india?

Answered: 1 week ago

Question

Explain the concept of going concern value in detail.

Answered: 1 week ago

Question

=+5 How does HRM relate to efforts to increase innovation?

Answered: 1 week ago