2015-07-24 4 views
0

Я работаю над программой статистического анализа, которая рассчитает множество вещей. Мне не нужна помощь в сборке, потому что я понимаю, как это нужно выполнить. Проблема, с которой я сталкиваюсь в массиве, который я построил. Я получаю действительно странный вывод, когда я пытаюсь отобразить данные. Ниже приведен выходСтатистический анализ

public class Project_StatisticalAnalysis { 

    public static void main(String[] args){ 


     System.out.println("Good Day,"); 
     System.out.println(); 
     System.out.println("This program can run statistical analysis on integer"); 
     System.out.println("data up to 100 values; it can calculate the mean,"); 
     System.out.println("median, mode, variance and standard deviation."); 
     System.out.println(""); 

     Scanner input = new Scanner(System.in); 
     System.out.println("Please enter the number of values you will be calculating: "); 
     int values = input.nextInt(); 

     //Create Array 
     final int numArray = values; 
     double [] numberValues = new double[numArray]; 
     double sum = 0; 
     for (int i = 0; i < numArray; i++){ 
      System.out.println("Please enter a number:"); 
     numberValues[i] = input.nextDouble(); 
     sum += numberValues[i]; 
     } 
     //Call to Methods: 
     displayNumbers(numberValues, values); 
     sort(numberValues); 
     mean(numberValues); 
     median(numberValues); 
     mode(numberValues); 
     standardDeviation(numberValues); 
     variance(numberValues);  
     } 

     public static void displayNumbers(double numberValues[], double values) { 
      System.out.println("You entered:"); 
      System.out.println(); 
      int count = 0; 
      for (int i = 0; i <values; i++){ 
      System.out.print(numberValues+" ");   
      count++; 
      if (count == 10) { 
       System.out.println(); 
       count = 0; 
      }} 


     } 

     public static void sort(double numberValues[]){ 

     } 

     public static void mean(double numberValues[]){ 


     } 

     public static void median(double numberValues[]){ 

     } 

     public static void mode(double numberValues[]){ 

     } 

     public static void standardDeviation(double numberValues[]){ 

     } 

     public static void variance(double numberValues[]){ 


     } 
} 

Выход:

Good Day, 

This program can run statistical analysis on integer 
data up to 100 values; it can calculate the mean, 
median, mode, variance and standard deviation. 

Please enter the number of values you will be calculating: 
12 
Please enter a number: 
4 
Please enter a number: 
4 
Please enter a number: 
4 
Please enter a number: 
4 
Please enter a number: 
4 
Please enter a number: 
4 
Please enter a number: 
5 
Please enter a number: 
8 
Please enter a number: 
4 
Please enter a number: 
5 
Please enter a number: 
4 
Please enter a number: 
4 
You entered: 

[[email protected] [[email protected] [[email protected] [[email protected] [[email protected] [[email protected] [[email protected] [[email protected] [[email protected] [[email protected] 
[[email protected] [[email protected] 
+0

Я не понимаю, почему отображается каждое значение [D @ 5c647s05 – Techmom

ответ

2

Вместо

System.out.print(numberValues+" "); // отображает адрес

записи

System.out.print(numberValues[i]+" "); // отображает значение здесь

+0

Спасибо, Сатья! – Techmom

+0

приветствуется @Techmom – Satya

Смежные вопросы