title: How to make a method that searches a parallel array?
body: <p>I have written a working parallel array list that stores 12 countries and their corresponding populations. I am having some trouble with second piece of my assignment. I have to create a method that searches the array for the country/population that the user inputs. (For example, if the user inputs "United Kingdom", then it's corresponding population would print). However, I'm not sure how to tackle this. 
  Any tips and advice would be greatly appreciated!    </p>
  
  <pre><code>import java.util.Scanner;
  
  public class InClassModule12
     {
        public static void main(String[] args)
        {
       String[] country = {"United States", "Brazil", "China", "Italy", "United Kingdom", "Spain", "Japan", "Germany", "France", "Turkey", "South Africa", "Argentina"};
       int[] population = { 319111000, 203462000, 1367960000, 60783711, 64105654, 46507760, 127090000, 80767000, 66050000, 76667864, 54002000, 42669500};
  
       for ( int i = 0; i &lt; country.length; i++ )
       { 
         System.out.print( country[i]+ "'s population: " + " ");
          System.out.print( population[i] );
          System.out.println();
       }
  
    }
  }
  </code></pre>
  
  <p>Edited: This is the exact assignment:
  In a program you need to store the populations of 12 countries.
  Define two arrays that may be used in parallel to store the names of the countries and their populations.
  Write a loop that uses these arrays to print each country's name and its population.
  Add a loop in your main method which asks the user running it if they would like to look up a given country's population. When they indicate “No” the program terminates.
  Prompt user: What country would you like to look up?
  Upon user entering something the program calls the countryLookup method.
  countryLookup method accepts an argument (parameter) containing what the user entered for the country to look up. The method searches country name array for the name and upon finding it returns the corresponding population from the population array.  If it doesn't find the country simply return -1.</p>