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 name of file that contained the data
int mnumRows; number
int numCols; number of columns in the data
doubledataArray; array the data is stored in
it also has the private functions:
double ComputeAveragedouble array, int length; Average the array values
double FindMaxValuedouble array, int length; Find max value in array
The class has the following public member functions:
void SetDataDimensionsint rows, int cols; sets the number of columns & rows
void ReadDatastring fileName; Reads in the data file after seting # columns & rows
The data is stored in mdataArray by column
double FindAverageInColumnint index; Averages column column #index of data array
double FindMaxValueInColumnint index; Finds max value in column #index
For the last two functions, index can be from to numCols
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 rows and 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 and and the read in the data in the file provided,
named testDataSet.txt Compute the average of column index that is the second
column Also, find the maximum value in column index that is the fourth column
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
