-1
我已經給了一些數據(最高溫度,最低溫度,降雨量等),我們的任務是在Eclipse中讀取這些數據,然後分析數據。如何在Eclipse中顯示CSV數據的平均值等?
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class assign1 {
public static void main(String[] args) throws IOException {
\t // declare variables
\t String line;
\t
\t //
\t BufferedReader file = new BufferedReader(new FileReader("weatherdata.csv"));
\t System.out.println("Year, Month, Temp, Rain");
\t
\t while((line = file.readLine()) != null) {
\t System.out.println(line);
\t }
\t
\t
\t \t file.close();
\t }
}
當我運行程序,數據和標題的顯示精細,正如預期,在控制檯中。
但我的問題是,
如何我現在得到顯示數據的平均值等?
做你自己的作業! – hasan