create a class called DataSet. This class will have a default constructor that is empty, but an overloaded constructor that takes an integer argument and creates a vector with that many random numbers in it. For example, if I created:
DataSet d1 = new DataSet(500);
...it would create a vector inside that dataset with 500 randomly generated integers in it. Your DataSet class should also have functions that return the size of the dataset, the max number in the set, the min number in the set, and the average. You should not have any public member variables other than the string that names the dataset (pick whatever name you want for them...).
In your main code you will create three instances of that class and then analyze them. I want to see a list of the name, size, min, max, and avg of each dataset and I want this for dataset sizes of 10, 100, 1,000, and 10,000. The output should be simple but aligned.
For example:
Set1
10 1 9 4.5
100 0 98 49.2
etc., then Set2, then Set3.
Finally, I would like a cross-listed avg, so the same as above but only one list with the averages of all three sets data in it.
1 answer
Apply the following format:
Set the width for printing to 10 and use & as a fill character.
The number of significant digits that be printed is 3