Parallel Arrays Lookup

Use 2 arrays to store pairs of related data, like names and salaries.
For example:

   String[] names = {"Anna" , "Bob" , "Carla" , "Doug"};
   double[] salaries = {49000, 99000, 30000, 60000};

Write a method that accepts a name as a parameter,
searches for the name and returns the matching salary.
If the name is not found, it should return -1.

Solution

public double findSalary( String target )
{
    for(int c = 0;  c < names.lengthc = c+1)
    {
        if( names[c].equals( target ) )
        {
            return salaries[c];
        }
    }
    return -1 ;
}