Question: You are to write a class named DataSet. The data set is a rectangular data set with a fixed number of rows and columns that

You are to write a class named "DataSet". The data set is a rectangular data set with a
fixed number of rows and columns that is readin from some file.
The class has the following private member data:
string m?filename;// name of file that contained the data
int m_numRows; // number
int m-numCols; // number of columns in the data
double*m-dataArray; // array the data is stored in
it also has the private functions:
double ComputeAverage(double* array, int length); // Average the array values
double FindMaxValue(double* array, int length); // Find max value in array
The class has the following public member functions:
void SetDataDimensions(int rows, int cols); // sets the number of columns & rows
void ReadData(string fileName); // Reads in the data file after seting # columns & rows
// The data is stored in m_dataArray by column
double FindAverageInColumn(int index); // Averages column column #index of data array
double FindMaxValueInColumn(int index); // Finds max value in column #index
For the last two functions, index can be from 0 to m?numCols-1.
Declare your class in a file named DataSet.h. Define any class functions in DataSet.cpp.
Using the data set in the file testDataSet.txt, which has 1000 rows and 4 columns. In
your program main, create a instance of your DataSet class. Then, use it to set the rows
and columns in the data set (to 1000 and 4), and the read in the data in the file provided,
named testDataSet.txt. Compute the average of column index 1(that is the second
column). Also, find the maximum value in column index 3(that is the fourth column).
You are to write a class named "DataSet". The

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 Programming Questions!