The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Need help on problem #2 (loan am calculator). Need the help asap as it is due tonight. Thanks
Â
1Due Date: Monday, Feb. 15, 2016 before 11:55pm.Purpose:This homework involves some further basics of C++ programming,specifically loops. You will also get to work with random numbers again, which areimportant in formulating solutions to a multitude of problems in the scientific communityand elsewhere (see the motivation for the introduction of random number generation inthe last homework assignment (i.e., HW2)).Instructions:The instructions are similar to previous homework’s:This is an individual, not collaborative assignment; remember to be carefulwith naming rules; etc. See the HW 1 or HW2 descriptions for more details.Problem A: Tossing a Fair DieWrite a C++ program that simulates tossing a fair six-sided die. Your program shoulddo the following:1. Ask the user to input a random seed (of typeint), and callsrandwith thenumber that is input as its argument. Thus, right after the variable declarations inyour program, you should have the lines:cout << "Input the random seed: ";cin >> seed;srand(seed);2. Use thecstdlibfunctionrand()to generate a random number between 1 and 6.Note that the number 1 corresponds to one dot on the side of a die; the number 2corresponds to two dots on the side of a die, and so on for the numbers 2, 3, 4,5, and 6, where each number represents the number of dots on the side of a six-sided die. All possibilities (one dot through six dots) should be equally likely tooccur when a die is rolled. Repeat this process 100 times, and keep a count ofthe number of times each dot occurs when the die is rolled.3. Repeat Step 2 (i.e., generate another 100 random numbers) and count the number oftimes each number of dots surfaces on the die.4. Print out the results, that is, the counts for each time each side of the die was rolled,and the average value for the 100 rolls of the die for each set.
Attachments:
-----------