I am writing a program in Java in which the user is supposed input an integer, n. My program should then create an array where the entries are [1.25^0], [1.25^1], . . ., [1.25^n]. In order to make this work I have attempted to use the pow()-method. My code for creating the array is as follows:
for (int i = 0; i < n; i++) {
functionG[i] = pow(1.25, n); }
This is, however, giving me the error message: “the method pow(double, int) is unidentified for the type Functions” (Functions is the name of my class).
Does anyone know how I can fix this? I am pretty sure I am on the right track, I just need to get the method to work properly.
Any help will be greatly appreciated!
Use Math.pow(double, double), or statically import
powas such: