diff --git a/java/number-of-senior-citizens.java b/java/number-of-senior-citizens.java new file mode 100644 index 0000000..331cf98 --- /dev/null +++ b/java/number-of-senior-citizens.java @@ -0,0 +1,15 @@ +class Solution { + public int countSeniors(String[] details) { + int count = 0; + + for (String citizen : details) { + var age = Integer.parseInt(citizen.substring(11, 13)); + + if (age > 60) { + ++count; + } + } + + return count; + } +}