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:
	
	
	
		
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
	
		
			
		
		
	
				
			OK, an explination of what i need to do:
I need to get the output of this little program to look like this:
How many numbers? 100
How many intervals? 10
Histogram
--------------------------------------------------------
1 ****(4)
2 ******(6)
3 ***********(11)
4 *****************(17)
5 **************************(26)
6 *************************(25)
7 *******(7)
8 ***(3)
9 (0)
10 *(1)
--------------------------------------------------------
And The program performs the following actions:
1. Ask the user to enter the number of numbers that will be generated and the number of intervals that will be used in the histogram, and input the two values;
2. Generate the required number of pseudo-random numbers by using the double[] Generator.getData(int n), which, given the number of numbers to generate, n, returns an array of double of size n containing the generated numbers;
3. Compute the range of data values (by finding the maximum and the minimum and taking their difference); then compute the width of each equally-sized interval (by dividing the whole range by the number of intervals specified by the user); finally, compute the number of data numbers falling in each interval and store these frequencies in an array of integers;
4. Output the histogram of the data as displayed in the sample run above: each bar starts with an index (1 through the number of intervals), followed by a number of '*' equal to the number of numbers in that range, followed by the number of '*' in parentheses.
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:
How many numbers? 10
How many Intervals? 5
Histogram
--------------------------------------------------------
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