Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a class named StatAnalysis that contains at least the methods described b

ID: 3694808 • Letter: C

Question

Create a class named StatAnalysis that contains at least the methods described below, as well as fields that help store the data found in the file you will analyze. This class must include the following method:

public double average(int columnNumber) - this method takes a single parameter that represents the column number in the CSV file. If the data in that column is numerical, the method returns the average of the values in the column. If the data in that column is not numerical, or if the column number refers to a non-existent column, it should return -1.

public double median (int columnNumber) – same as above, but computes the median of the corresponding column

Explanation / Answer

class StatAnalysis

{

public double average(int columnNumber)

{

if(columnNumberisNumeric)

{

return avgOfValues;

}

else

{

return -1;

}

public double median(int columnNumber)

{

if(columnNumberisNumeric)

{

return MedianOfValues;

}

else

{

return -1;

}

}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote