From 457af8fd1d46912e3d02b924a97c1a479a1c269a Mon Sep 17 00:00:00 2001 From: Lukas Reichwein Date: Tue, 16 Jul 2019 18:16:10 +0200 Subject: [PATCH] removed a typo and added documentation to the absoluteValueOf function --- src/main/java/com/ugsbo/complexnumcalc/ComplexNumber.java | 4 ++++ .../complexnumcalc/AbsoluteValueOfComplexNumbersTest.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/ugsbo/complexnumcalc/ComplexNumber.java b/src/main/java/com/ugsbo/complexnumcalc/ComplexNumber.java index b55cc87..ca5fddc 100644 --- a/src/main/java/com/ugsbo/complexnumcalc/ComplexNumber.java +++ b/src/main/java/com/ugsbo/complexnumcalc/ComplexNumber.java @@ -128,6 +128,10 @@ public class ComplexNumber { return qoutient; } + /** + * Calucates the absolute value of this complex number + * @return the absolute value + */ public Double absolutValueOf(){ Double absoluteValue = Math.sqrt(Math.pow(this.realPart, 2) + Math.pow(this.imaginaryPart, 2)) ; return absoluteValue; diff --git a/src/test/java/com/ugsbo/complexnumcalc/AbsoluteValueOfComplexNumbersTest.java b/src/test/java/com/ugsbo/complexnumcalc/AbsoluteValueOfComplexNumbersTest.java index 48a3d70..594ce13 100644 --- a/src/test/java/com/ugsbo/complexnumcalc/AbsoluteValueOfComplexNumbersTest.java +++ b/src/test/java/com/ugsbo/complexnumcalc/AbsoluteValueOfComplexNumbersTest.java @@ -6,7 +6,7 @@ import org.junit.Test; public class AbsoluteValueOfComplexNumbersTest { @Test - public void TheAbsoluteValueOfAComplexNumberWithOnlyARealPart_IsNotTHeAbsoluteValueOfTheRealPart() { + public void TheAbsoluteValueOfAComplexNumberWithOnlyARealPart_IsNotTheAbsoluteValueOfTheRealPart() { ComplexNumber complexNumber = new ComplexNumber(Double.valueOf(4), Double.valueOf(0)); Double expected = Double.valueOf(4);