Skip to content

Commit a3e0975

Browse files
fixed identified bugs
1 parent 7bec682 commit a3e0975

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/thealgorithms/maths/ZellersCongruence.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static String calculateDay(String input) {
5151
try {
5252
LocalDate.of(year, month, day);
5353
} catch (DateTimeException e) {
54-
throw new IllegalArgumentException("Invalid date.");
54+
throw new IllegalArgumentException("Invalid date.", e);
5555
}
5656
if (month <= 2) {
5757
year -= 1;
@@ -63,7 +63,7 @@ public static String calculateDay(String input) {
6363
int t = (int) (2.6 * month - 5.39);
6464
int u = century / 4;
6565
int v = yearOfCentury / 4;
66-
int f = Math.round((day + yearOfCentury + t + u + v - 2 * century) % 7);
66+
int f = (int) Math.round((day + yearOfCentury + t + u + v - 2 * century) % 7.0);
6767

6868
int correctedDay = (f + 7) % 7;
6969

@@ -88,7 +88,7 @@ private static int parsePart(String part, int min, int max, String error) {
8888
}
8989
return value;
9090
} catch (NumberFormatException e) {
91-
throw new IllegalArgumentException("Invalid numeric part: " + part);
91+
throw new IllegalArgumentException("Invalid numeric part: " + part, e);
9292
}
9393
}
9494

0 commit comments

Comments
 (0)