Write the following function in JavaSolutionAccording to my
Write the following function in Java:
Solution
According to my deductions from the question the following code snippet should work. Not implementing C() fully just for test purpose.
makeMangler method of class Mangle takes 3 inputs and sets the class variables and returns a type interface.
//Mangler.java
 package com.test;
public interface Mangler {
   //Tester Class
    void C1(int i, int j, int k, int l);
}
------------------------------------------------------------------------------------------------------------------
//Mangle.java
 package com.test;
public class Mangle implements Mangler {
   int num1;
    int num2;
    int num3;
   
    //makeMangler takes 3 inputs returns interface Mangler
    public Mangler makeMangler(int a, int b, int c) {
        Mangle setValues = new Mangle();
       
        setValues.num1 = a;
        setValues.num2 = b;
        setValues.num3 = c;
       
        return setValues;
    }
   @Override
    //Tester class
    public void C1(int i, int j, int k, int l) {
        // TODO Auto-generated method stub
        int temp = i * num1;
        int temp2 = temp + num2;
        temp = temp2 * num3;
        System.out.println(\"Output C1 is \" + temp); //calculated just for one
    }
   
    public static void main(String[] args) {
        Mangle a = new Mangle(); //get class object
        Mangler m = a.makeMangler(2,3,8); //calling make mangler returning interface Mangler
        m.C1(4,8,2,9);
    }
}

