问答题
【说明】 本程序根据输入的月份数,输出它是哪个季节。 【代码】 import java.io.*; public class season
public static void main(String[] args)
String strln=""; (1) in=new InputStreamReader(System.in); BufferedReader buffln=new BufferedReader(in); System.out.print("Please enter a month(1-12):"); try
strln=buffln.readLine();//从命令行读入数据 catch( (2) )
System.out.println(e.toStdng());
int month= (3) (strln);//将字符串转换成整数型 int season=0; if(month<12 && month>0) eseason=((month+10)%12)/3+1;//计算季节的公式 (4) (season)
case 1: System.out.println("the season is Springl"); break; case 2: System.out.println("the season is Summer!"); case 3: System.out.println("the season is Fall!"); case 4: System.out.println("the season is Winter!"); break; (5) ; System.out.println("this is not correct month!");
【正确答案】(1)InputStreamReader (2)IOException e (3)Integer.parseInt (4)switch (5)default