modify division instance method error message
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user