需要将中值和标准偏差添加到以下程序中,但我不知道从哪里开始,我知道我想要它做什么,但不知道如何实现它,特别是因为中值必须在排序数字之后但是如果我将它作为 void Median () 放入,我会丢失已排序的数组。请帮忙!非常感谢任何帮助:
import java.util.Scanner;
import javax.swing.*;
public class JScannerO
{
public JScannerO(){}
public JScannerO(int A)
{
HowMuch = A;
}
void GenerateNumbers()
{
int k,Hide;
k = 0;
while ( k < HowMuch )
{
Hide = (int) (Math.random() * 100);
if ( Hide > 9 && Hide < 100 )
{
Hanson[k] = Hide;
k++;
}
}
}
void DisplayNumbers()
{
int k;
for ( k = 0; k < HowMuch; k++)
{
System.out.println("\t\tThe numbers are : " + Hanson[k]);
}
}
void BiggestNumber()
{
int k,Biggest;
Biggest = Hanson[0];
for ( k = 0; k < HowMuch; k++)
{
if ( Biggest < Hanson[k] ) Biggest = Hanson[k];
}
System.out.println("\n\n\t\tThe biggest number is : " + Biggest);
}
void SmallestNumber()
{
int k,Smallest;
Smallest = Hanson[0];
for ( k = 0; k < HowMuch; k++)
{
if ( Smallest > Hanson[k] ) Smallest = Hanson[k];
}
System.out.println("\n\n\t\tThe Smallest number is : " + Smallest);
}
void Average()
{
int k,Sum;
double Average;
Sum = 0;
for ( k = 0; k < HowMuch; k++)
{
Sum = Sum + Hanson[k];
}
Average = 1.0 * Sum / HowMuch;
System.out.format("\n\n\t\tThe Average number is : %7.2f",Average);
}
void Sort()
{
int k,Hide;
boolean DidISwap;
DidISwap = true;
while (DidISwap)
{
DidISwap = false;
for ( k = 0; k < HowMuch - 1; k++)
{
if ( Hanson[k] > Hanson[k+1] )
{
Hide = Hanson[k ];
Hanson[k] = Hanson[k+1];
Hanson[k+1] = Hide ;
DidISwap = true;
}
}
}
System.out.println("\n\n\n\t\tThe Sorted Numbers : \n");
}
private int HowMuch;
private int[] Hanson = new int[100];
}
这是通过使用调用程序运行的