BarGraph

-1 Gilbert Diaz · August 31, 2014
I need help with a homework since my professor does not explain in class. Is about java, here is where I need help. In the homework I need to enter up to 40 numbers no greater than 8; (i.e 2 4 5 1 8 7 3) first I need to count how many numbers I enter, and second I need to know which number were. The print out should be like this; 

Number of values to graph: 3 
1 2 3 


# # 
# # # 
--------- 
1 2 3

Once I compile in terminal Im going to enter a sequence of number, in this case I entered 1 2 3; I want to be able to count that I enter 3 numbers, and second I want to be able to know each number that I did entered which are 1 2 3 and the print out should be as above.

Post a Reply

Replies

Oldest  Newest  Rating
0 Gilbert Diaz · September 1, 2014
import java.util.Scanner;

public class BarGraph
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);

System.out.println("How many Graph would you like to show?");
int numGraph = sc.nextInt();

int[] ng = new int[numGraph];
System.out.println("Enter the " + numGraph + "number you like");

for (i = 0; i <= ng.length; i++)
{

}
}
}
0 Pere Garau Burguera · August 31, 2014
Have you tried? Post the code you have by now. 
  • 1

Java / Android Development

107,243 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator