The Math2 Class


The Math2 Class

Let's begin the development process by defining a skeleton version of the Math2 class. At the top of the class goes the declaration to place the Math2 class in the TechJava.MathLib package. We are going to define six methods in the class. The log10() method will compute the base 10, or common, logarithm. The logX() method will compute the logarithm of a number according to a user -specified base. The next three methods will calculate hyperbolic trigonometric values. The final method will compute a higher transcendental function known as the gamma function.

 package TechJava.MathLib; public class Math2 {   public static double log10(double a) {   }   public static double logX(double a, double b) {   }   public static double sinh(double a) {   }   public static double cosh(double a) {   }   public static double tanh(double a) {   }   public static double gamma(double a) {   } } 

In the following sections we will implement each method in the Math2 class.



Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net