Hello all. I am working on some homework and i can't seem to figure the whole thing out completely. I have ben going back and forth and just cant seem to figure it out.

OK, an explination of what i need to do:

I need to get the output of this little program to look like this:

While that does not seem to hard i seem to be having some trouble.

Right now this is what my program looks like:

Code:

import java.util.Scanner;
public class messwith {
/**
* @param args
*/
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.print("How many numbers? ");
int numbers = keyboard.nextInt();
System.out.print("How many Intervals? ");
int intervals = keyboard.nextInt();
double[] rand_num = Generator.getData(numbers);
double max = max(rand_num);
double min = min(rand_num);
double inter_size = intervalSize(max, min, intervals);
int[] amount = numbers(rand_num, inter_size, min, intervals);
outPutResults(numbers, rand_num, amount);
}
private static double max(double[] rand_num)
{
double max = 0;
for(int index = 0; index < rand_num.length; index++)
{
if(rand_num[index] > max)
{
max = rand_num[index];
}
}
return max;
}
private static double min(double[] rand_num)
{
double min = 0;
for(int index = 0; index < rand_num.length; index++)
{
if(rand_num[index] < min)
{
min = rand_num[index];
}
}
return min;
}
private static double intervalSize(double max, double min, int intervals)
{
double range = max - min;
double width = range/intervals;
return width;
}
private static int[] numbers(double[] rand_num, double inter_size, double min, int intervals)
{
int[] numbers = new int[intervals];
int index = 0;
double count_interval = min + inter_size;
while(index < intervals)
{
int begin = 0;
int count = 0;
while(begin < (intervals-1))
{
if(rand_num[begin] >= min && rand_num[begin] < count_interval)
{
count++;
}
numbers[index] = count;
}
}
return numbers;
}
private static void outPutResults(int numbers, double[] rand_num, int[] amount)
{
int index = 0;
System.out.println("Histogram");
System.out.println("--------------------------------------------------------");
while(index < numbers)
{
System.out.print((index + 1) + " ");
while(index < rand_num[index])
{
System.out.print("*");
}
System.out.println("(" + rand_num[index] + ")");
index++;
}
System.out.println("-------------------------------------------------------");
}
}

While i thought this would work i seem to be having troubles. I cant seem to get it to print anything besides this:

As you can see i have some problems in there that i cant seem to figure out. I was hopfing to get this done by friday afternoon cause this has to be turned in sunday night. I am not going to be at the school this weekend so i am trying to turn it in early.

If anyone can give me some help it would be appreciated!!!

Thanks