MainApplication.java 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /**
  2. * Created by leon on 2/9/18.
  3. */
  4. import java.util.Scanner;
  5. public class MainApplication {
  6. ScientificOperations sos=new ScientificOperations();
  7. public static void main(String[] args)
  8. {
  9. System.out.println("Enter first and second number:");
  10. Scanner inp= new Scanner(System.in);
  11. int num1,num2;
  12. num1 = inp.nextInt();
  13. num2 = inp.nextInt();
  14. int ans;
  15. System.out.println("Enter your selection: 1 for Addition, 2 for substraction 3 for Multiplication and 4 for division:");
  16. int choose;
  17. choose = inp.nextInt();
  18. switch (choose){
  19. case 1:
  20. System.out.println(add( num1,num2));
  21. break;
  22. case 2:
  23. System.out.println(sub( num1,num2));
  24. break;
  25. case 3:
  26. System.out.println(mult( num1,num2));
  27. break;
  28. case 4:
  29. System.out.println(div( num1,num2));
  30. break;
  31. default:
  32. System.out.println("Illigal Operation");
  33. case 5:
  34. System.out.println(ScientificOperations.Exponent(3,3));
  35. break;
  36. case 6:
  37. System.out.println(ScientificOperations.Inverse(5));
  38. break;
  39. case 7:
  40. System.out.println(ScientificOperations.ScientificSin(90));
  41. break;
  42. case 8:
  43. System.out.println(ScientificOperations.ScientificCosin(90));
  44. break;
  45. case 9:
  46. System.out.println(ScientificOperations.ScientificTan(90));
  47. break;
  48. case 10:
  49. System.out.println(ScientificOperations.InverseCos(90));
  50. break;
  51. case 11:
  52. System.out.println(ScientificOperations.InverseSin(180));
  53. break;
  54. }
  55. }
  56. public static int add(int x, int y)
  57. {
  58. int result = x + y;
  59. return result;
  60. }
  61. public static int sub(int x, int y)
  62. {
  63. int result = x-y;
  64. return result;
  65. }
  66. public static int mult(int x, int y)
  67. {
  68. int result = x*y;
  69. return result;
  70. }
  71. public static int div(int x, int y)
  72. {
  73. int result = x/y;
  74. return result;
  75. }
  76. }