title: Search and match in Txt file (Java)
body: <p>Hi guys please is there anyone can help me out with this program?</p>
  
  <p>write a program that asks the user to enter a postcode and returns the city for that
  postcode. If the postcode in not in the list then it should return city not found.
  The find city code must be in a separate method findCity()
  The user should be able to continue entering postcodes until they enter 9999 to indicate they
  are complete (9999 should not appear as “city not found”)</p>
  
  <p>================================================
  in the txt file:</p>
  
  <p>Dandenong 3175
  Frankstone 3199
  Berwick 3816
  Cranbourne 3977
  Rosebud 3939</p>
  
  <hr>
  
  <p>Thats what i've done so far.</p>
  
  <pre><code>import java.io.File;
  </code></pre>
  
  <p>import java.io.FileNotFoundException;
  import java.util.Scanner;</p>
  
  <pre><code>public class test2 {
  
      public static void main(String[] args) throws FileNotFoundException
      {
          try
          {
              File f = new File("Files\\cities.txt");
              Scanner input = new Scanner(f);
              String text;
              while(input.hasNextLine())
              {
                  text = input.nextLine();
                  process(text);
              }
  
  
          }
          catch (FileNotFoundException ex)
          {
              System.out.println(ex.getMessage());
          }   
      }
  
      public static void process(String text)
      {   String name = null;
      int id;
          Scanner code = new Scanner(System.in);
          System.out.println("enter the postcode");       
          id = code.nextInt();
          Scanner data = new Scanner(text);
  
           if(code.equals(0))System.out.println(name);
  
          name = data.next();
          id = data.nextInt();
  
          while(data.hasNextDouble())
          {
  
          }
      System.out.println(name+ " ");
  //  System.out.println(id+ " ");
      }
  }
  </code></pre>