From 42cf862d11bc10df190ddf52eedb05be5c5899fa Mon Sep 17 00:00:00 2001 From: zanninso Date: Tue, 16 Jul 2024 21:22:41 +0100 Subject: [PATCH] docs: adding example for singular period --- subjects/java/checkpoints/monthly-period/README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/subjects/java/checkpoints/monthly-period/README.md b/subjects/java/checkpoints/monthly-period/README.md index 52d9a3ba8..725316dbd 100644 --- a/subjects/java/checkpoints/monthly-period/README.md +++ b/subjects/java/checkpoints/monthly-period/README.md @@ -21,6 +21,7 @@ public class MonthlyPeriod { } } ``` + ### Usage Here is a possible `ExerciseRunner.java` to test your class: @@ -30,20 +31,21 @@ public class ExerciseRunner { public static void main(String[] args) { MonthlyPeriod MonthlyPeriod = new MonthlyPeriod(); - // Test case 1 String startDate1 = "2020-01-01"; String endDate1 = "2023-06-15"; System.out.println("Period: " + MonthlyPeriod.calculatePeriod(startDate1, endDate1)); - // Test case 2 String startDate2 = "2015-05-20"; String endDate2 = "2015-10-20"; System.out.println("Period: " + MonthlyPeriod.calculatePeriod(startDate2, endDate2)); - // Test case 3 String startDate3 = "2018-12-25"; String endDate3 = "2021-12-25"; System.out.println("Period: " + MonthlyPeriod.calculatePeriod(startDate3, endDate3)); + + String startDate3 = "2018-10-25"; + String endDate3 = "2019-11-30"; + System.out.println("Period: " + MonthlyPeriod.calculatePeriod(startDate3, endDate3)); } } ``` @@ -56,5 +58,6 @@ $ java -cp build ExerciseRunner Period: 3 years and 5 months Period: 5 months Period: 3 years +Period: 1 year and 1 month $ ```