// (from the Carter book)
// Exercise 2.6(8). Find the value of each trigonmetric
// expression, using Math.sin, Math.cos, Math.tan,
// Math.asin, and Math.atan. Also include the return
// type of each Math method. (The return values are
// between 0.0 and 1.0.)
public class MathMethodExercises2
{
public static void main (String[] args)
{
// Part (8a) -- Math.sin:
System.out.println (Math.sin (Math.PI / 6));
// return type is float
// Part (8b) -- Math.cos:
System.out.println (Math.cos (Math.PI / 3));
// return type is float
// Part (8c) -- Math.cos:
System.out.println (Math.cos (0));
// return type is float
// Part (8d) -- Math.atan:
System.out.println (Math.atan (0));
// return type is float
// Part (8e) -- Math.tan:
System.out.println (Math.tan (Math.atan (0.5)));
// return type is float
// Part (8f) -- Math.asin:
System.out.println (Math.asin (Math.sin (1)));
// return type is float
} // main method
} // MathMethodExercises2 class
No comments:
Post a Comment