package com.imooc.javabeginner.second.weatherforecast;
import com.imooc.weather.HourWeather;
import com.imooc.weather.WeatherUtils;
import com.imooc.weather.impl.WeatherUtilsImpl;
import java.util.List;
import java.util.Scanner;
public class QueryWeather {
public static void main(String[] args) {
String appCode = "xxxxxx";
System.out.println("可以选择的服务如下所示:");
System.out.println("1:查询24h内的天气信息");
System.out.println("2: 查询3天内的天气信息");
System.out.println("3: 查询7天内的天气信息");
System.out.print("请选择所需服务的代号:");
Scanner scanner = new Scanner(System.in);
int i = scanner.nextInt();
if (i == 1){
System.out.print("请输入所需查询天气的城市名称:");
String city = scanner.next();
WeatherUtils weatherUtils = new WeatherUtilsImpl();
List<HourWeather> weatherList = weatherUtils.w24h(appCode, city);
System.out.println(weatherList);
}
}
}
