modify division instance method error message

This commit is contained in:
2026-04-26 18:57:47 +03:30
parent f1ae92771a
commit ce0861233b
+1 -1
View File
@@ -86,7 +86,7 @@ public class Rational {
// COMPLETED - Instance method - this / other // COMPLETED - Instance method - this / other
public Rational divide(Rational other) { public Rational divide(Rational other) {
if (other.numerator == 0) { if (other.numerator == 0) {
throw new ArithmeticException("Invalid division. Denominator will be zero"); throw new ArithmeticException("Caught division by zero");
} }
int newNumerator = this.numerator * other.denominator; int newNumerator = this.numerator * other.denominator;