Thursday, February 12, 2015

SpringSeason.java in pgm



SpringSeason.java
public class SpringSeason
 {
    public static void main(String[] args)
{
        int month = Integer.parseInt(args[0]);
        int day   = Integer.parseInt(args[1]);
        boolean isSpring =  (month == 3 && day >= 20 && day <= 31)
                         || (month == 4 && day >=  1 && day <= 30)
                         || (month == 5 && day >=  1 && day <= 31)
                         || (month == 6 && day >=  1 && day <= 20);

        System.out.println(isSpring);
    }
}

No comments:

Post a Comment