Results 1 to 3 of 3

Thread: Histrogram

  1. #1
    Bgreen7887 is offline Senior Member
    Join Date
    Oct 2010
    Location
    Newark,nj
    Posts
    111
    Rep Power
    0

    Default Histrogram

    hey guys working on a histrogram , that shows frequency distribution of numbers entered from user.arrays are giving me trouble(particularly storing values inside of them).
    HERES WHAT I HAVE SO FAR
    Java Code:
    import java.util.Scanner;
    public class Histogram 
    {
    	public static void main(String[] args )
    	{
    		int i = 0;
    		int[] holder = new int[101];
    		Scanner scan = new Scanner(System.in);
    		System.out.println("Please enter a couple of number");
    		int y = scan.nextInt();
    		
    		while(y >=0) 
    			{
    				System.out.println("Please enter a couple of number");
    				//holder[y]++;
    				 y = scan.nextInt();
    				 
    		
    			}
    					if(y <=10){	System.out.println("*****");
    
    					
    					
    							for(i = 0 ; i <holder.length; i++)
    							{
    											System.out.println(holder[i]);
    
    							}
    							// I WANT TO PRINT DIFF. # OF ASTER. FOR EACH VALUE I.E 1-10 (*****),11-20(**********), MAYBE AND SO ON 
    			     }
    		}
    }

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,879
    Rep Power
    8

    Default

    Did you have a question?

  3. #3
    Bgreen7887 is offline Senior Member
    Join Date
    Oct 2010
    Location
    Newark,nj
    Posts
    111
    Rep Power
    0

    Default

    YES , once i store the results of the user input in variable y, how do i pass that onto my array?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •