Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class weatherproject {
  3.     public static void main(String[] args) {
  4.         Scanner in = new Scanner(System.in); //System.in = system input
  5.         String city;
  6.         String state;
  7.         String j;
  8.        
  9.         System.out.println("Enter a city: ");
  10.         city = in.nextLine();
  11.         city = city.replaceAll(" ", "_");
  12.         System.out.println("Enter a state's initials: ");
  13.         state = in.nextLine();
  14.         j = "http://api.wunderground.com/api//conditions/q/" + city + "/" + state + ".json";
  15.         city = city.replaceAll("_", " ");
  16.         System.out.println("You entered: " + "'" + city + ", " + state + "'");
  17.         System.out.println("The url to be called is " + j);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement