Salary > Compile Undo Cut Соpy Paste Find. Close Source Code // The program should prompt the user with employee names, like: // "What is the salary of Xiaoxing?" for(int i = 0; i<3; i++){ System.out.println("What is the salary of"+names[i]); salaries[i] = input.nextDouble(); // Then, modify the statements below to print out the average salary of all employees // and the NAME of the employee with the highest salary // You should invoke the methods index0fHighest(), and getArrayAverage(). // The average number should have two decimal points System.out.printf("The average salary is:%.2f\n",getArrayAverage(salaries)); System.out.println("The employee with the highest salary is:"+names[index0fHighest(salaries) ]); incompatible types: double[] cannot be converted to int[] private static double getArrayAverage(double[] input){ double sum = 0; for (double val:input) sum+=val; return sum/input.length; private static int index0fHighest(int[] input){ int highestIndex=0; for (int i =0;iinput[highestIndex]) highestIndex = i; return highestIndex;
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
I want help fixing this error.
Step by step
Solved in 2 steps