1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import java.math.BigInteger;
-
- public class Scientific
- {
- // instance variables - replace the example below with your own
- private int x;
-
- /**
- * Constructor for objects of class Scientific
- */
- public Scientific()
- {
- // initialise instance variables
- x = 0;
- }
-
- public static double sine(double angle, int mode)
- {
- if (mode == 0) {
- angle = Math.toRadians(angle);
- }
- return Math.sin(angle) ;
- }
-
- public static double cosine(double angle, int mode)
- {
- if (mode == 0) {
- angle = Math.toRadians(angle);
- }
- return Math.cos(angle) ;
- }
-
- public static double tangent(double angle, int mode)
- {
- if (mode == 0) {
- angle = Math.toRadians(angle);
- }
- return Math.tan(angle) ;
- }
-
- public static double inverseSin(double angle, int mode)
- {
- if (mode == 0) {
- angle = Math.toRadians(angle);
- }
- return Math.asin(angle) ;
- }
-
- public static double inverseCosine(double angle, int mode)
- {
- if (mode == 0) {
- angle = Math.toRadians(angle);
- }
- return Math.acos(angle) ;
- }
-
- public static double inverseTangent(double angle, int mode)
- {
- if (mode == 0) {
- angle = Math.toRadians(angle);
- }
- return Math.atan(angle) ;
- }
-
- public static BigInteger factorial(double x)
- {
- int y = (int) x;
- BigInteger factorialValue = BigInteger.valueOf(1);
- for (int i=1; i<=y; i++) {
- factorialValue = factorialValue.multiply(BigInteger.valueOf(i));
- }
- return factorialValue;
- }
-
- }
-
|