12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
-
- /**
- * Write a description of class scienticFunctions here.
- *
- * @author (Roy Mpanju)
- * @version (a version number or a date)
- */
-
- import java.lang.*;
- public class scienticFunctions
- {
- // instance variables - replace the example below with your own
- //private int x;
-
- /**
- * Constructor for objects of class scienticFunctions
- */
- // public scienticFunctions()
- // {
- // // initialise instance variables
- // x = 0;
- // }
-
- /**
- * A method - find the cosine of a given number
- *
- * @param y a sample parameter for a method
- * @return the cosine of y
- */
- public double cosine(double y)
- {
- double x = Math.toRadians(y);
-
- return Math.cos(x);
- }
-
- /**
- * A method - find the sine of a given number by converting it to radians
- *
- * @param y a sample parameter for a method
- * @return the sine of y
- */
- public static double sine(double y){
- return Math.sin(Math.toRadians(y));
- }
-
- public static double cos(double y){
- return Math.cos(Math.toRadians(y));
- }
-
- public double tangent(double y){
- return Math.tan(Math.toRadians(y));
- }
-
- public double inverseCosine(double y){
- return Math.acos(y) * 180/Math.PI;
- }
-
- public double inverseSine(double y){
- return (Math.asin(y))* 180/Math.PI;
- }
-
- public double inverseTangent(double y){
- return (Math.atan(y))*180/Math.PI;
- }
- }
|