Question: Code in C++ For this assignment, write a program that will calculate statistics for small groups of random numbers. For the groups of numbers, calculate

Code in C++

For this assignment, write a program that will calculate statistics for small groups of random numbers.

For the groups of numbers, calculate the following:

  • the smallest value in a group
  • the largest value in a group
  • the sum of all of the values in a group
  • the average of all of the values in a group

Seed the random number generator with a value of 24. Note: other seed values may be used to produce different results. However, the version that is handed in for grading MUST use a seed value of 24.

Generate a random number between 2 and 10. This will be the number of values in the first group. Display the number of values in the group with an appropriate label.

In a for loop that executes exactly "number of values in the first group" number of times, generate a random number between 1 and 50, display the random number, and perform the calculations that are necessary to calculate the statistics.

After the for loop has finished executing, display the four statistics with appropriate labels. Any value with a decimal point should be displayed with exactly 2 digits after the decimal point. All of the statistical values should be displayed with the last digits lining up.

Now, generate a random number between 2 and 10. This will be the number of values in the second group. Display the number of values in the group with an appropriate label.

Using a while loop that executes exactly "number of values in the second group" number of times, generate a random number between 1 and 50, display the random number, and perform the calculations that are necessary to calculate the statistics.

After the while loop has finished executing, display the four statistics with appropriate labels. Any value with a decimal point should be displayed with exactly 2 digits after the decimal point. All of the statistical values should be displayed with the last digits lining up.

Finally, generate a random number between 2 and 10. This will be the number of values in the third group. Display the number of values in the group with an appropriate label.

Using a do while loop that executes exactly "number of values in the third group" number of times, generate a random number between 1 and 50, display the random number, and perform the calculations that are necessary to calculate the statistics.

After the do while loop has finished executing, display the four statistics with appropriate labels. Any value with a decimal point should be displayed with exactly 2 digits after the decimal point. All of the statistical values should be displayed with the last digits lining up.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!