aboutsummaryrefslogtreecommitdiff
path: root/challenge-019/cheok-yin-fung/java/FiveWeekends.java
blob: bea36cd4584988c41223191c9dfe0015de1e0a09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// The Weekly Challenge - 019
// Task 1 Five Weekends
// attempt: May 09th, 2021
// from: C.-Y. Fung
// Usage: java FiveWeekends [year]
import java.time.LocalDate;
import java.time.DayOfWeek;
import java.time.Month;

public class FiveWeekends
{
    public static void main(String[] args) 
    {
        int[] months = new int[] {1, 3, 5, 7, 8, 10, 12};

        for (int i = 1900; i <= 2019; i++)
            for (int M: months)
                if (LocalDate.of(i,M,1).getDayOfWeek() == DayOfWeek.FRIDAY)
                    System.out.println(i+" "+ Month.of(M));

    }
}