Duo Collab

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import java.util.Scanner;
  2. import java.lang.Math;
  3. import java.lang.*;
  4. /**
  5. * @Joshua Chung & Mexi Liang
  6. * @1.0 05/27/2018
  7. */
  8. public class Calculator extends Main{
  9. public double add(double x, double y){
  10. return x + y;
  11. }
  12. public double subtract(double x, double y){
  13. return x - y;
  14. }
  15. public double multiply(double x, double y){
  16. return x * y;
  17. }
  18. public double divide(double x, double y){
  19. return x / y;
  20. }
  21. public double getPow(double x, double y){
  22. return Math.pow(x, y);
  23. }
  24. public double invert(double x){
  25. return x * (-1);
  26. }
  27. public double square(double x){
  28. return x * x;
  29. }
  30. public double squareRoot(double x){
  31. return Math.sqrt(x);
  32. }
  33. public double getInverse(double x){
  34. return (1/x);
  35. }
  36. public double getCosine(double x){
  37. return Math.cos(x);
  38. }
  39. public double getSine(double x){
  40. return Math.sin(x);
  41. }
  42. public double getTan(double x){
  43. return Math.tan(x);
  44. }
  45. public double inverseSin(double x){
  46. return Math.asin(x);
  47. }
  48. public double inverseCos(double x){
  49. return Math.acos(x);
  50. }
  51. public double inverseTan(double x){
  52. return Math.atan(x);
  53. }
  54. public static double factorial(double x){
  55. double result = 1;
  56. for(double value = 2; value <= x; value++) {
  57. result *= value;
  58. }
  59. return result;
  60. }
  61. public double log(double x){
  62. return Math.log10(x);
  63. }
  64. public double inverseLog(double x){
  65. return Math.exp(x);
  66. }
  67. public double natLog(double x){
  68. return Math.log(x);
  69. }
  70. public long round(double x){
  71. return Math.round(x);
  72. }
  73. }