I do not understand how to do this.
Instructions: Use a loop to determine and display the name of the person with the highest salary (hint you will need to keep track of the index of the highest salary, then use this index to access the correct name).
MY PROBLEM:
The person with the highest salery is Chris Kennedy:$61,500.00.
but I am unsure how to determine that with a loop?
Code I have:
import java.text.*;
import java.util.Scanner;
public class Exam2_1
{
public static void main (String [] args)
{
DecimalFormat currency = new DecimalFormat("$#,##0.00");
double [] salery={ 45000.00, 27500.00, 61500.00, 32200.00, 51800.00};
String[] employees= { "John Smith", "Mary King", "Chris Kennedy", "Angela Jones", "Mark Smith"};
System.out.println(employees[3] + " has a salery of " + currency.format(salery[3]));
for (int index=0; index<employees.length; index++)
{
System.out.println(employees[index]);
}
double total=0;
double average;
for (int index=0; index < salery.length; index++)
{
total+=salery[index];
}
average=total/salery.length;
System.out.println("The average salery is " + currency.format(average));
double highest=salery[0];
for (int index=1; index < salery.length; index++)
{
if (salery[index] > highest)
highest=salery[index];
}
System.out.println("The highest salery is " + currency.format(highest));
}
}

