Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a. Declare an interface Filter that has a method accept() which accepts as parameter an Object, and retur b. ns a Boolean. [3] c. Provide

image text in transcribed
a. Declare an interface "Filter" that has a method accept()" which accepts as parameter an Object, and retur b. ns a Boolean. [3] c. Provide an abstract class ShortWordFilter that implements the interface Filter". [3] d. Extend two concrete classes Less ThanFive and LessThanTen from ShortWordFilter class, such that both have an ArrayList of type String to store the words. [3] e. Define a static method "collectAll" that accepts as parameters two arguments, an arraylist of type String and a reference of type Filter. The method returns an arraylist of type Filter containing two polymorphic references to objects of the sub dasses containing ArrayList filled with words that are accepted by the given filter. [7] f. Then write a testclass that reads all words from System in, puts them into an ArrayList

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_2

Step: 3

blur-text-image_3

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

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

Identify three types of physicians and their roles in health care.

Answered: 1 week ago

Question

Compare the types of managed care organizations (MCOs).

Answered: 1 week ago