Source of JoeMath.java


  1: /**
  2:    A class of static methods to perform various mathematical
  3:    computations, including the square root.
  4:    @author Frank M. Carrano
  5:    @author Timothy M. Henry
  6:    @version 4.0
  7: */
  8: public class JoeMath
  9: {
 10:    /** Computes the square root of a real number.
 11:        @param value  A real value whose square root is desired.
 12:        @return  A string containing the square root. */
 13:    public static String squareRoot(double value)
 14:    {
 15:       String result = "";
 16:       try
 17:       {
 18:          Double temp = OurMath.squareRoot(value);
 19:          result = temp.toString();
 20:       }
 21:       catch (SquareRootException e)
 22:       {
 23:          Double temp = OurMath.squareRoot(-value);
 24:          result = temp.toString() + "i";
 25:       }
 26:       
 27:       return result;
 28:    } // end squareRoot
 29:    
 30:    // < Other methods not relevant to this discussion could be here. >
 31: } // end JoeMath