Source of JoeMathDriver.java


  1: /**
  2:    A demonstration of a runtime exception using the class JoeMath.
  3:    @author Frank M. Carrano
  4:    @author Timothy M. Henry
  5:    @version 5.0
  6: */
  7: public class JoeMathDriver
  8: {
  9:    public static void main(String[] args)
 10:    {
 11:       System.out.print("The square root of 9 is ");
 12:       System.out.println(JoeMath.squareRoot(9.0));
 13:       
 14:       System.out.print("The square root of -9 is ");
 15:       System.out.println(JoeMath.squareRoot(-9.0));
 16:       
 17:       System.out.print("The square root of 16 is ");
 18:       System.out.println(JoeMath.squareRoot(16.0));
 19:       
 20:       System.out.print("The square root of -16 is ");
 21:       System.out.println(JoeMath.squareRoot(-16.0));
 22:    } // end main
 23: } // end JoeMathDriver
 24: /*
 25:  The square root of 9 is 3.0
 26:  The square root of −9 is 3.0i
 27:  The square root of 16 is 4.0
 28:  The square root of −16 is 4.0i
 29: */