Guest User

Untitled

a guest
Apr 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1.     public void search() {
  2.         String search;
  3.         System.out.print("Please type the last name, email, or zip code you are searching for: ");
  4.         Scanner scan = new Scanner(System.in);
  5.         search = scan.nextLine();
  6.  
  7.         int e = 0;
  8.  
  9.         int count = 0;
  10.  
  11.         while (e < listSpot) {
  12.             while (null != list[e]) {
  13.                 if (search.equalsIgnoreCase(list[e].getLastName()) || search.equalsIgnoreCase(list[e].getEmail()) || search.equalsIgnoreCase(list[e].getZipCode())) {
  14.                     System.out.print("\n" + ++count + ": ");
  15.                     list[e].printContact();
  16.                 }
  17.                 e++;
  18.             }
  19.             if (count < 1) {
  20.                 System.out.println("No matches found for: " + search);
  21.             }
  22.         }
  23.     }
Add Comment
Please, Sign In to add comment