Advertisement
INSECURE-FLOWERPOT

Untitled

Feb 27th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. Scanner input = new Scanner(System.in);
  2.  
  3. String choice;
  4. System.out.println("State or City?");
  5. choice = input.next();
  6. if(choice.equalsIgnoreCase("State"))
  7. {
  8. System.out.print("Enter State abbreviation:");
  9. choice=input.next();
  10. Place p = new Place("A","B","C");
  11. for(int i=0; i<place.size(); i++)
  12. {
  13. p=place.get(i);
  14. if(p.getState().equals(choice))
  15. {
  16. break;
  17. }
  18. }
  19.  
  20. if(p.getState().equals(choice))
  21. {
  22. System.out.println(p.getState()+": ");
  23. System.out.println();
  24. p.finalDisplay1();
  25. }
  26. }
  27. else if(choice.equalsIgnoreCase("City"))
  28. {
  29. System.out.println("Enter state abbreviation: ");
  30. String state=input.next();
  31. System.out.println("Enter a city: ");
  32. String city = input.next();
  33. System.out.println();
  34. Place p =new Place("A","B","C");
  35. for(int i=0; i<place.size(); i++)
  36. {
  37. p=place.get(i);
  38. if(p.getState().equals(state))
  39. {
  40. System.out.println(city+", "+state+": ");
  41. System.out.println();
  42. p.finalDisplay2(city);
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement