aboutsummaryrefslogtreecommitdiff
path: root/challenge-019/cheok-yin-fung/java/FiveWeekends.java
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-05-09 10:35:19 +0100
committerGitHub <noreply@github.com>2021-05-09 10:35:19 +0100
commit03b1587632c5f61d0fc5684aa4448d5c253939d2 (patch)
treef1096fda87ae58e4315d11376f873100eef30d99 /challenge-019/cheok-yin-fung/java/FiveWeekends.java
parente32de6c08d7fa5c32ed7b6c9ea74992141f855bd (diff)
parent7a0fc047ae3e6742da844b472e6acf2e88d20581 (diff)
downloadperlweeklychallenge-club-03b1587632c5f61d0fc5684aa4448d5c253939d2.tar.gz
perlweeklychallenge-club-03b1587632c5f61d0fc5684aa4448d5c253939d2.tar.bz2
perlweeklychallenge-club-03b1587632c5f61d0fc5684aa4448d5c253939d2.zip
Merge pull request #4032 from E7-87-83/newt
Practice date and time stuff
Diffstat (limited to 'challenge-019/cheok-yin-fung/java/FiveWeekends.java')
-rw-r--r--challenge-019/cheok-yin-fung/java/FiveWeekends.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/challenge-019/cheok-yin-fung/java/FiveWeekends.java b/challenge-019/cheok-yin-fung/java/FiveWeekends.java
new file mode 100644
index 0000000000..bea36cd458
--- /dev/null
+++ b/challenge-019/cheok-yin-fung/java/FiveWeekends.java
@@ -0,0 +1,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));
+
+ }
+}