Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner input = new Scanner(System.in);
- String choice;
- System.out.println("State or City?");
- choice = input.next();
- if(choice.equalsIgnoreCase("State"))
- {
- System.out.print("Enter State abbreviation:");
- choice=input.next();
- Place p = new Place("A","B","C");
- for(int i=0; i<place.size(); i++)
- {
- p=place.get(i);
- if(p.getState().equals(choice))
- {
- break;
- }
- }
- if(p.getState().equals(choice))
- {
- System.out.println(p.getState()+": ");
- System.out.println();
- p.finalDisplay1();
- }
- }
- else if(choice.equalsIgnoreCase("City"))
- {
- System.out.println("Enter state abbreviation: ");
- String state=input.next();
- System.out.println("Enter a city: ");
- String city = input.next();
- System.out.println();
- Place p =new Place("A","B","C");
- for(int i=0; i<place.size(); i++)
- {
- p=place.get(i);
- if(p.getState().equals(state))
- {
- System.out.println(city+", "+state+": ");
- System.out.println();
- p.finalDisplay2(city);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement