Question
Please help to fix this JAVA code again. I download file iris.csv as the following format, but still can not run the program Please download
Please help to fix this JAVA code again. I download file iris.csv as the following format, but still can not run the program
Please download data from iris.csv file or use this table
sepal_length | sepal_width | petal_length | petal_width | species |
5.1 | 3.5 | 1.4 | 0.2 | setosa |
4.9 | 3 | 1.4 | 0.2 | setosa |
4.7 | 3.2 | 1.3 | 0.2 | setosa |
4.6 | 3.1 | 1.5 | 0.2 | setosa |
5 | 3.6 | 1.4 | 0.2 | setosa |
5.4 | 3.9 | 1.7 | 0.4 | setosa |
I think the code is correct but it shows something like this when run program
Exception in thread "main" java.lang.NumberFormatException: For input string: "setosa" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) at java.lang.Double.parseDouble(Double.java:538) at StatisticalMethods.
------------------------------------------ import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.Scanner; class StatisticalMethods{ private double [][]x; private final int row,col; private String []flowerType; public StatisticalMethods(String path){ row=150; col=4; x=new double[row][col]; flowerType=new String[row]; String line; try{ BufferedReader br=new BufferedReader(new FileReader(path)); line=br.readLine(); int j=0; while((line=br.readLine())!=null){ String []instance=line.split(","); for(int i=0;i
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