Declare an interface Filter as follows:

public interface Filter
   boolean accept(Object x);

Modify the implementation of the DataSet class in Section to use both a Measurer and a Filter object. Only objects that the filter accepts should be processed. Demonstrate your modification by having a data set process a collection of bank accounts, filtering out all accounts with balances less than $1,000.

Complete the following files:

Use the following file:

   This program tests the use of a Measurer and a Filter.
public class DataSetTester
   public static void main(String[] args)
      class BankMeasurer implements Measurer
         public double measure(Object anObject)
            BankAccount ba = (BankAccount) anObject;
            return ba.getBalance();
      class BankFilter implements Filter
         public boolean accept(Object x)
            BankAccount ba = (BankAccount) x;
            return ba.getBalance() > 1000;
      Measurer m = new BankMeasurer();
      Filter f = new BankFilter();
      DataSet data = new DataSet(m, f);
      data.add(new BankAccount(1));
      data.add(new BankAccount(100));
      data.add(new BankAccount(2000));
      data.add(new BankAccount(950));
      data.add(new BankAccount(4000));

      System.out.println("Average balance: " + data.getAverage());
      System.out.println("Expected: 3000.0");

      BankAccount b = (BankAccount) data.getMaximum();
      double balance = b.getBalance();
      System.out.println("Highest balance: " + balance);      
      System.out.println("Expected: 4000.0");