"Christian" <> wrote in message
news:481b5fea$0$25892$...
> Pierre8r schrieb:
>> Hello,
>>
>> I have a array like this :
>>
>> double[] array = { 10.1, 34.0, 15.0, 22.5, 24.2, 31.0, 32.0, 37.0 };
>>
>> I search to know
>> how many values there are :
>> <10
>> how many values there are between :
>> >= 10 and < 20
>> how many values there are between :
>> >= 20 and < 30
>> how many values there are :
>> >= 30
>>
>> Regards,
>>
>> Pierre8r
> Homework is meant to be done by you. It should help you to learn the
> basics of java.
>
> 2 tips:
> 1. array[i] you can access the i-th index of the array..
> 2. You will want to use a for-loop to get all positions in the array
I'll just add to that, you only need to look at each value once. Also, for
this particular case, use of some functions in java.lang.Math will avoid the
use of conditionals.
AHS
|