Question: Java coding trouble! I'm having trouble writing some helper methods. so I have an arraylist and have been asked to write a few methods that

Java coding trouble!

I'm having trouble writing some helper methods. so I have an arraylist and have been asked to write a few methods that I've described below.

ArrayList measurements = new ArrayList();

1. A public method called countAbove(). This method takes one argument, a double value called threshold. This method returns an int value for the number of elements in measurements that exceed the value of threshold. It performs this by calling a private helper method (which you also need to define) that uses head recursion to traverse the values of the measurements attribute. 2. A public method called countBelow(). This method takes one argument, a double value called threshold. This method returns an int value for the number of elements in measurements that are less than the value of threshold. It performs this by calling a private helper method (which you also need to define) that uses tail recursion to traverse the values of the measurements attribute.

I am having issues with my recursion. Any help is appreciated.

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 Databases Questions!