package com.javarush.task.task04.task0411;
/*
Времена года на Терре
*/
public class Solution {
public static void main(String[] args) {
checkSeason(12);
checkSeason(4);
checkSeason(7);
checkSeason(10);
}
public static void checkSeason(int month) {
//напишите тут ваш код
if (12 <= month && month <= 2){
System.out.println("зима");
}
if (3 <= month && month <= 5) {
System.out.println("весна");
}
if (6 <= month && month <= 8) {
System.out.println("лето");
}
if (9 <= month && month <= 11) {
System.out.println("осень");
}
}
}
весна
лето
осень
Process finished with exit code 0
у меня мозг лопается, я могу решить по другому, но не понимаю почему это не работает....
package com.javarush.task.task04.task0411;
/*
Времена года на Терре
*/
public class Solution {
public static void main(String[] args) {
checkSeason(12);
checkSeason(4);
checkSeason(7);
checkSeason(10);
}
public static void checkSeason(int month) {
//напишите тут ваш код
if (12 <= month && month <= 2){
System.out.println("зима");
}
if (3 <= month && month <= 5) {
System.out.println("весна");
}
if (6 <= month && month <= 8) {
System.out.println("лето");
}
if (9 <= month && month <= 11) {
System.out.println("осень");
}
}
}