Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: You have been tasked to validate the standard random number generator. In this program, you will generate random numbers and validate the values produced

Problem: You have been tasked to validate the standard random number generator. In this program, you will generate random numbers and validate the values produced by the random number generator.

#include #include #include

using namespace std;

Part 1: Write the prototype for the MinMax function.

Returns nothing

Parameter: A double array (this array must not be modifiable)

Parameter: A double minimum by-reference

Parameter: A double maximum by-reference

Parameter: A double average by-reference

Parameter: A double stddev by-reference

Part 2: Write the prototype for the GetRandom function.

Returns an integer

Takes an integer variable

const int MAX_VALUES = 30; int main() { int seed; int highest_value; int divisor; double minimum; double maximum; double avg; double stddev; while (true) { //This is an infinite loop 

Part 3: Declare an array of doubles that contains MAX_VALUES elements. Name this array values.

cin >> seed; cin >> highest_value; cin >> divisor;

Part 4: You now have a seed in seed. If the user enters -1 for the seed, break the infinite loop. Otherwise, seed your random number generator using this seed.

Part 5: Write a loop that stores random numbers into all of the elements of the values array, starting with the first element. First, get a random number by calling your GetRandom function. You will need to pass it the value of highest_value. Then divide the returned value by divisor. The result needs to be stored into the values array.

Part 6: Call your MinMax function and use the already declared minimum, maximum, avg, and stddev variables.

Part 7: Make your output precise to three (3) decimal places in fixed notation. You must use IO manipulators.

cout << "Data Statistics for " << seed << ", " << highest_value << ", " << divisor << endl; cout << "Min: " << minimum << ", Max: " << maximum << endl; cout << "Dev: " << stddev << ", Avg: " << avg << endl; cout << endl; } // End of the while(true) infinite loop return 0; }

Part 8: Write your function definition for MinMax. This function will search through the passed array:

Store the smallest value into the first by-reference parameter

Store the largest value into the second by-reference parameter

Store the average of all of the array's values into the third by-reference parameter

Calculate and store the standard deviation of all of the array's values into the fourth by-reference parameter.

Part 9: Write your function definition for GetRandom. This function:

Returns a random number starting with 0 up to and including the integer parameter

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_2

Step: 3

blur-text-image_3

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

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

Define Administration?

Answered: 1 week ago

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago