public static String answer(vector alpha, vector beta){
return (alpha.additionVector(beta)).vectortoString();
}
I want to apply this method to other operations. However, the other operators include dot product cross product etc.. So instead of limiting this method into only adding vectors, I would like this method to apply dot product or cross product. the parameter will effect the additionVector and potentially replace it depending on the parameters given.
I'm not exactly sure where to start as I tried putting the output of the non static method as one of the parameter.
public static String answer(vector alpha, vector beta, vector operator){
return (alpha.operator(beta)).vectortoString();
}
But then it assumes that operator()
is a function rather than a parameter.
Edit: let me try to rephrase the question.
I have a method called crossProduct()
that returns the cross product of two vectors.
I have another method called subtraction()
that returns the subtraction between two vectors.
What I want to do is this:
public String answer(vector alpha, vector beta, x){
//where x is the non static method for the vector class and takes in a vector
return (alpha.x(b)).vectortoString();
}