Strategy 3
- 
The
E3interface has avoid pickle()method and aint gc()method. Write the completeE3interface. - 
There is nothing to do in this question, it just shows the
TestStuffmessage. All of yourdemomethods should go in this class. 
public class TestStuff {
   public static void tester(E3 v) {
        System.out.println(v.gc());
        System.out.println(v.gc());
        v.pickle();
        System.out.println(v.gc());
        v.pickle();
        System.out.println(v.gc());
    }
}
- The 
E3Aclass implements theE3interface. Make it behave according to the demo code below. You will need to write a constructor and some methods. 
    public static void demoA() {
        E3A x = new E3A(5);
        tester(x); // prints 5 5 7 9
    }
}
- The 
E3Bclass implements theE3interface. Add thedemoBmethod to theTestStuffclass and make yourE3Bclass behave as described. 
public static void demoB() {
    E3B y = new E3B (3,7);
    tester(y); // prints 21, 21, 35, 49
    E3B z = new E3B (3,10);
    tester(z); // prints 30, 30, 50, 70
    E3B w = new E3B (5,10);
    tester(w); // prints 50, 50, 70, 90
}
- The 
E3Cclass is a subclass ofE3B. Add thedemoCmethod toTestStuffand implement theE3Cclass. 
public static void demoC() {
    E3C y = new E3C (3,7);
    tester(y); // prints 21, 21, 21, 21
    E3C z = new E3C (5,10);
    tester(z); // prints 50, 50, 50, 50
}
- The code below is placed in the 
TestStuffclass. Without it, write the predicted result from each line. If the given line is an error, indicate that and ignore the line. 
public static E3 bOnly(E3B w) {
    w.gc();
    return w;
}
public static void demoD() {
    E3B m = new E3B(4,5);   // line 1
    E3B p = new E3C(-2,30); // line 2
    E3 x;
    x = bOnly(m); // line 3
    tester(x);    // line 4
    x = bOnly(p); // line 5
    tester(x);    // line 6
}
- Does this work? Explain precisely why or why not. Fix if possible.
 
public static void demoE() {
    E3B n = new E3A(20);
    E3B x = bOnly(n);
    tester(x);
}