Help with Standard Deviation and Median in Java - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help with Standard Deviation and Median in Java

glamazon19glamazon19 Posts: 1Member
Need to add Median and Standard Deviation to the following program, but I have no idea where to starts, I know what I want it to do but am not sure how to make it happen especially since the median has to come after the sorted numbers but if I put it in as void Median (), I loose the sorted array. Please help! Any assistance is much appreciated:

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(" The 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("

The 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("

The 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("

The 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("


The Sorted Numbers :
");

}
private int HowMuch;
private int[] Hanson = new int[100];
}

**This is run by using a calling program**
Sign In or Register to comment.