Method contains takes an array of integers and returns true if there exists any item in the array that satisfies a specified condition. For instance, in the following code fragment: The intended result...


Method contains takes an array of integers and returns true if there exists any item in the array that satisfies a specified condition. For instance, in the following code fragment:


The intended result is that result1 is true because 37 is a prime number, result2 is true because both 100 and 49 are perfect squares, and result3 is false because there are no negative numbers in the array.


Implement the following components:


 a. An interface that will be used to specify the second parameter to contains.


b. The contains method (which is a static method).


c. The classes Negative, Prime, and PerfectSquare.



Dec 18, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here