Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions