Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CECS 524 Program 1 Due Feb 6, 2023 2PM Problem: You are to create a C++ class for performing some basic statistics on a data
CECS 524 Program 1 Due Feb 6, 2023 2PM Problem: You are to create a C++ class for performing some basic statistics on a data set of integers. The data set must have at least one element and up to 100,000,000. The statistics to be computed are
mean = 55.1786 min = 9 max = 100 sample variance = 828.7447 sample standard deviation = 28.7879 median = 52.5000 Output complete Sample run in column format. This program calculates several basic statistics for a data set of integers of any size > 0 && 100,000,000 Enter file name:data.txt Enter an integer number at least as big as the data set:67 Do you want to print the data set in a table(Y/N):n Data set size = 28 9 12 20 22 23 23 30 34 34 37 39 45 45 51 54 65 67 67 67 74 78 78 88 91 95 98 99 100 max = 100 sample variance = 828.7447 sample standard deviation = 28.7879 median = 52.5000 Output complete The DataSet class declaration. You may not change anything about it or add anything to it. /*************************************************************** * class DataSet performs basic statistics on a data set of * * integers. The data set size must be at least 1 but not more * * than 100,000,000. The only screen output is done in * * LoadData(std::ifstream &in); (if an error occurs loading * * PrintAll(bool table). * ***************************************************************/ class DataSet { int *dataset; //holds the data int size; //size of data in the set int limit; //size of the array public: double mean(); //returns the mean of dataset int min(); //returns the minimum value of dataset int max(); //returns the maximum value of dataset double standev(); //returns the standard deviation of dataset double median(); //returns the median value of dataset double variance(); //returns the variance of dataset int getSize(); //returns the size of dataset DataSet(int s); //constructs the dataset array //PrintAll prints the dataset in either a table=true //or one column if table =false void PrintAll(bool table); /* LoadData checks if the file \"in\" is open and attempts to load the dataset from the input file. If the file is not open print \"file not open\". If the file contains more data the limit entered, stop attempting to read and return. */ void LoadData(std::ifstream &in); void sort();
- mean of the data set,
- minimum value of the data set,
- maximum value of the data set,
- sample variance of the data set,
- sample standard deviation of the data set,
- and the median value of the data set.
9 | 12 | 20 | 22 | 23 | 23 | 30 | 34 | 34 | 37 |
39 | 45 | 45 | 51 | 54 | 65 | 67 | 67 | 67 | 74 |
78 | 78 | 88 | 91 | 95 | 98 | 99 | 100 |
Attachments:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started