How do I give input directly, when that function is invoked in another method, especially when that input is a double[] array?
public double dotPro1(double[] vectorA, double[] vectorB) {
double[] vecPro;
vecPro = new double[2];
vecPro[0] = vectorA[0]*vectorB[0];
vecPro[1] = vectorA[1]*vectorB[1];
return vecPro[0] + vecPro[1];
}
public double dotPro2(double[] length) {
double[] lenPro;
lenPro = new double[1];
lenPro[0] = length[0];
return lenPro[0];
}
public static double cosine(double a) {
double x = Math.cos(Math.toRadians(a));
/*Class c = Class.forName("NaiveStrategy");
Class methodTypes[] = new Class[3];
methodTypes[0] = Double.TYPE;
methodTypes[1] = Double.TYPE;
methodTypes[2] = Double.TYPE;
Method[] m = c.getMethods();*/
NaiveStrategy ns = new NaiveStrategy();
problem-->ns.dotPro1(vectorA[], vectorB[]);
problem-->ns.dotPro2(length[]);
return 0;
}
As you can also see my old coding I tried in another way to solve it, but it didn't worked. It's commented out above.
dotPro2just{ return length[0]; }? What's with all the uselessdouble[]manipulation?