about summary refs log tree commit diff
path: root/usth/ICT2.2/labwork/1/SpringSeason.java
blob: 2fda09b8a155eeaddbe5f0223cb846c8d8c6f97c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.time.LocalDate;
import java.time.DateTimeException;

class SpringSeason
{
  private static final LocalDate start = LocalDate.of(42, 3, 19);
  private static final LocalDate end = LocalDate.of(42, 6, 21);

  public static void main(String... args)
  {
    int m = Integer.parseInt(args[0]);
    int d = Integer.parseInt(args[1]);
    try
      {
        LocalDate query = LocalDate.of(42, m, d);
        // Yes, I'm sorry for leaving it here.
        // If only Java has the try-except-else like Python!
        System.out.println(query.isAfter(start) && query.isBefore(end));
      }
    catch (DateTimeException e)
      {
        System.out.println(false);
      }
  }
}