我很難寫這個程序。我對JAVA非常陌生,我有基本的理解。但我似乎無法理解它要求我做什麼。循環和文件統計Java程序
import java.text.DecimalFormat;
import java.util.Scanner;
import java.io.*;
public class StatsDemo
{
public static void main(String [] args) throws IOException
{
double sum = 0;
int count = 0;
double mean = 0;
double stdDev = 0;
String line;
double difference; //difference between the value and the mean
DecimalFormat threeDecimals = new DecimalFormat("0.000");
Scanner keyboard = new Scanner (System.in);
String filename;
System.out.println("This program calculates statistics"
+ "on a file containing a series of numbers");
System.out.print("Enter the file name: ");
filename = keyboard.nextLine();
這裏是一些從Number.txt這行程序應該讀取的行。
87.5517
72.14015
88.24248
60.524
65.38684
94.48039
84.73287
84.74978
73.78996
你的具體問題是什麼?你只是說明你的家庭作業。 – tomishomo 2014-10-27 19:58:53
我遇到了任務4和5的麻煩。我想知道是否有人能告訴我爲什麼我寫的是錯的,我需要做什麼。 – James 2014-10-27 20:05:15