Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

7. Define cultural space.

Answered: 1 week ago

Question

8. Describe how cultural spaces are formed.

Answered: 1 week ago