Question: Q1. (20 pts.) Interface Filterable Design an interface named Filterable. This interface has only one method filter that returns true for objects that are accepted

 Q1. (20 pts.) Interface Filterable Design an interface named Filterable. This

Q1. (20 pts.) Interface Filterable Design an interface named Filterable. This interface has only one method filter that returns true for objects that are accepted (i.e., passes the filter) and false for objects that are rejected (i.e., does not pass the filter) Q2. (50 pts.) Class EncapsulatedNumber that implements Filterable Encapsulate the java.lang.Number class that is the superclass of classes BigDecimal, Biglnteger, Byte, Double, Float, Integer, Long, and Short. The name of this class will be EncapsulatedNumber. The requirements are given below: Every object of type EncapsulatedNumber contains a field named number of type Number. This field will be private Add a constructor that takes as argument a Number * Make this class implement the Filterable interface, such that method filter will return true when the number is positive (i.e., greater than 0.0 in its doubleValue) * Override the toString() method to return the String representation of the number. Q3. (30 pts.) static methods Implement the following 3 static methods public static void printArray(EncapsulatedNumberll arr) Correctness: prints all elements of the array on the console. Displayed values should be numeric. public static EncapsulatedNumberll filterEncapsulatedNumbers(EncapsulatedNumberll arr) Correctness: apply the filter on all input objects. If all fails to pass, then return null. Otherwise return an array that contains passing objects. public static void main(Stringl] args) Correctness: declare and initialize an array of EncapsulatedNumber objects. Print the array Filter the array. Then print the array again. 1. 2. 3

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!