weixin_慕慕7498354
2022-04-21 18:27
package com.H.weather;
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 Application {
public static void main(String[] args) {
System.out.println("查询最近天气预报");
System.out.println("输入1:查询未来24小时天气预报");
System.out.println("输入2:查询未来3天天气预报");
System.out.println("输入3:查询未来7天天气预报");
System.out.print("请输入您的选择:");
Scanner scanner=new Scanner(System.in);
int i= scanner.nextInt();
System.out.println("用户输入数字:"+i);
if (i==1){
System.out.println("请输入城市名称查询未来24小时天气预报");
String city= scanner.next();
WeatherUtils weatherUtils = new WeatherUtilsImpl();
List<HourWeather>weatherList=weatherUtils.w24h("d0c4a0b00eb14c21903e8ea220dc68ef",city);
System.out.println(weatherList);
}
}
}我这个运行起来之后就只能查24小时的,其他的输入数字之后不会让输入城市,就结束了
还没有人回答问题,可以看看其他问题
Java入门第二季
531293 学习 · 6327 问题
相似问题