From 7fdae4285b88bf65f176886eca10a09860adece3 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Mon, 24 Jul 2017 13:44:09 -0700 Subject: [PATCH] Fix copy pasting in NaiveNumber. --- src/org/nwapw/abacus/number/NaiveNumber.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/org/nwapw/abacus/number/NaiveNumber.java b/src/org/nwapw/abacus/number/NaiveNumber.java index b63008d..10b89a4 100644 --- a/src/org/nwapw/abacus/number/NaiveNumber.java +++ b/src/org/nwapw/abacus/number/NaiveNumber.java @@ -15,26 +15,22 @@ public class NaiveNumber implements Number { @Override public Number multiply(Number multiplier) { - if(!(multiplier instanceof NaiveNumber)) throw new IllegalArgumentException(); return new NaiveNumber(value * ((NaiveNumber)multiplier).value); } @Override public Number divide(Number divisor) { - if(!(divisor instanceof NaiveNumber)) throw new IllegalArgumentException(); - return new NaiveNumber(value * ((NaiveNumber)divisor).value); + return new NaiveNumber(value / ((NaiveNumber)divisor).value); } @Override public Number add(Number summand) { - if(!(summand instanceof NaiveNumber)) throw new IllegalArgumentException(); - return new NaiveNumber(value * ((NaiveNumber)summand).value); + return new NaiveNumber(value + ((NaiveNumber)summand).value); } @Override public Number subtract(Number subtrahend) { - if(!(subtrahend instanceof NaiveNumber)) throw new IllegalArgumentException(); - return new NaiveNumber(value * ((NaiveNumber)subtrahend).value); + return new NaiveNumber(value - ((NaiveNumber)subtrahend).value); } @Override