Create a class named StatAnalysis that contains at least the methods described b
ID: 3694809 • 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 String mode (int columnNumber) –this method returns the mode (the most frequent element) from a column.IMPORTANT: Updated! Tread the column as String even if the data contained within it is numerical. If the column number is incorrect, the method should return the special value null.
Explanation / Answer
Try with the below code by creating a program in CPP
ReadCSV reader = new ReadCSV("file.csv");
String[] header = reader.getHeader();
String[] columnType = reader.colTypes();
String [] data;
while ( (data = reader.getLine()) != null) {
// do something with the data
}
Double d = Double.parseDouble(data[5]); // converts the 6th column into a double
Integer i = Integer.parseInteger(data[2]); // converts the 3rd column into an integer
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.