27th Mar 2021, 7:34 PM
Amateur
2 odpowiedzi
+ 1
I think you are doing Element modify in line no.31 so use ModifyElement2(X,1); Instead of ModifyArray2(X,1);
27th Mar 2021, 8:32 PM
Jayakrishna 🇮🇳
+ 3
The message is: //يا رئوف public class Scoresofstudents { public static void main(String[] args) { double [] X = {14,16,19,20,15}; System.out.format("n \t= %d\n",X.length); System.out.format("Sum \t= %f\n",ArraySum(X)); System.out.format("Mean \t= %f\n",ArrayMean(X)); ./Playground/Scoresofstudents.java:30: error: method ModifyArray2 in class Scoresofstudents cannot be applied to given types; ModifyArray2(X,1); ^ required: double[] found: double[],int reason: actual and formal argument lists differ in length 1 error That says what your problem is fairly well. You passed 2 parameters when only 1 is expected. One solution is changing: ModifyArray2(X,1); to: ModifyArray2(X); The above change will solve your compilation error.
27th Mar 2021, 7:51 PM
Josh Greig
Josh Greig - avatar