1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import java.math.BigInteger;
  2. public class Scientific
  3. {
  4. // instance variables - replace the example below with your own
  5. private int x;
  6. /**
  7. * Constructor for objects of class Scientific
  8. */
  9. public Scientific()
  10. {
  11. // initialise instance variables
  12. x = 0;
  13. }
  14. public static double sine(double angle, int mode)
  15. {
  16. if (mode == 0) {
  17. angle = Math.toRadians(angle);
  18. }
  19. return Math.sin(angle) ;
  20. }
  21. public static double cosine(double angle, int mode)
  22. {
  23. if (mode == 0) {
  24. angle = Math.toRadians(angle);
  25. }
  26. return Math.cos(angle) ;
  27. }
  28. public static double tangent(double angle, int mode)
  29. {
  30. if (mode == 0) {
  31. angle = Math.toRadians(angle);
  32. }
  33. return Math.tan(angle) ;
  34. }
  35. public static double inverseSin(double angle, int mode)
  36. {
  37. if (mode == 0) {
  38. angle = Math.toRadians(angle);
  39. }
  40. return Math.asin(angle) ;
  41. }
  42. public static double inverseCosine(double angle, int mode)
  43. {
  44. if (mode == 0) {
  45. angle = Math.toRadians(angle);
  46. }
  47. return Math.acos(angle) ;
  48. }
  49. public static double inverseTangent(double angle, int mode)
  50. {
  51. if (mode == 0) {
  52. angle = Math.toRadians(angle);
  53. }
  54. return Math.atan(angle) ;
  55. }
  56. public static BigInteger factorial(double x)
  57. {
  58. int y = (int) x;
  59. BigInteger factorialValue = BigInteger.valueOf(1);
  60. for (int i=1; i<=y; i++) {
  61. factorialValue = factorialValue.multiply(BigInteger.valueOf(i));
  62. }
  63. return factorialValue;
  64. }
  65. }