Hi can someone help me with this question please?

  1. In "setup" Create an array of 1000 random integers between 0 and 100. Also, in "setup" declare an array of bins or counters to find out how many integers fall into one of the 10 "bins" 0-9, 10-19, 20 -29, 30-39,.................90-99.

You now pass the two arrays to a function called "counter" which will count how many elements fall into each of the bins. When you return to "setup" print out the numbers in each bin.

Recommended Answers

All 4 Replies

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules

Post what you have done so far and someone will help you from there.

Sorry I didn't know

here is what i came up with, but i don't know where i went wrong

void  setup( ){
  //an array  of 1000 random integers between 0  and 100
  int i;
  float randNum[];
  float sum;
  int howmany =1000;
  randNum = new float[howmany];

}

I have a similar problem. I declared my initial array (1000 random integers), but cannot figure out how to sort them.

void setup ( ) {
  size ( 500, 500);
  background (5);

  //make array of 1000 random integers
  int [ ] Array1000 = new int[1000];

  int n = 0;
  while (n < 1000) {
    Array1000[n] = int(random(0, 100));
    n = (n + 1);
  }

Here is an example of how to do the random number in Java (integer). From there, you should try to iterate through the array and categorize each value into your own bins (100 of them).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.