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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started