Strategy Quiz
Write the interface or class in each question.
- 
The
Kinterface has the following methods:int n()String s()void t(int k)
 - 
The class
Mimplements theKinterface. The constructor takes in a String, an initial number, and a bump number (bumpnum). In addition it has avoid bump()method that has the same effect ast(bumpnum). 
public static void testK(K x) {
    System.out.println(x.s());
    System.out.println(x.n());
    System.out.println(x.n());
    System.out.println(x.n());
    x.t(10);
    System.out.println(x.n());  
}
public static void testM(M y) {
    testK(y);
    y.bump();
    testK(y);
}
public static void demo1() {
    M x = new M("Good", 4, 100);
    testM(x); // Good 4 3 2 11
              // Good 110 109 108 117
}
- The class 
MNis a subclass ofMthat behaves the same asMexcept it prints out “Very ___". 
public static void demo2() {
    MN x = new MN("Medium", 4, 100);
    testM(x); // Very Medium 4 3 2 11
              // Very Medium 110 109 108 117
}
- The class 
MMis a subclass ofM. Thebumpmethod ofMMdoes the bump ofMtwice. 
public static void demo3() {
    MM x = new MM("Good", 5, 100);
    testM(x); // Good 5 4 3 12
              // Good 211 210 209 218
}
All-in-one Tester
public class StrategyQuiz {
    public static void testK(K x) {
        System.out.println(x.s());
        System.out.println(x.n());
        System.out.println(x.n());
        System.out.println(x.n());
        x.t(10);
        System.out.println(x.n());
    }
    public static void testM(M y) {
        testK(y);
        y.bump();
        testK(y);
    }
    public static void demo1() {
        M x = new M("Good", 4, 100);
        testM(x); // Good 4 3 2 11
                  // Good 110 109 108 117
    }
    public static void demo2() {
        MN x = new MN("Medium", 4, 100);
        testM(x); // Very Medium 4 3 2 11
        // Very Medium 110 109 108 117
    }
    public static void demo3() {
        MM x = new MM("Good", 5, 100);
        testM(x); // Good 5 4 3 12
    }
    public static void main (String[] args) {
        System.out.println("=== DEMO 1 ===");
        demo1();
        System.out.println("=== DEMO 2 ===");   
        demo2();
        System.out.println("=== DEMO 3 ===");
        demo3();
    }
}
Desired output:
=== DEMO 1 ===
Good
4
3
2
11
Good
110
109
108
117
=== DEMO 2 ===
Very Medium
4
3
2
11
Very Medium
110
109
108
117
=== DEMO 3 ===
Good
5
4
3
12
Good
211
210
209
218