Question: Write Java ( define ) a public static method named countInRange, that takes an ArrayList of Integer, and two additional int arguments and returns (

Write Java (define) a public static method named countInRange, that takes an ArrayList of Integer, and two additional int arguments and returns (as an int) a count of the number values in the ArrayList that are between the second and third argument values (inclusive). You can safely assume that the third argument value will always be greater than or equal to the second argument value.
For example:
given an ArrayList named myList that contains this list of values: {1,2,1,3,2,5,6,2,4}
countInRange(myList,1,6) should return 9
countInRange(myList,2,4) should return 5
countInRange(myList,10,20) should return 0
You may wish to write some additional code to test your method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!