import java.util.Scanner;
class IfSeasonDemo
{
public static void main(String[] args)
{
while(true)
{
System.out.println("请输入月份--------");
Scanner sc = new Scanner(System.in);
int season = sc.nextInt();
String month ;
if(season >=3 && season <=5)
{
month = "是春天";
}else if(season >=6&& season <=8)
{
month = "是夏天";
}else if(season >=9 && season <=11)
{
month = "是秋天";
}else if(season >12)
{
month = "你哪你有这个月份吗?你真逗哦!请重新输入----";
}else if(season ==0)
{
break ;
}else
{
month = "是冬天";
}
System.out.println("现在是:"+season+"份"+month);
}
}
} |
|