fork download
  1. //Lesson.java
  2.  
  3. package com.intJava;
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class Lesson {
  8. public static void main (String[] args){
  9. Scanner input = new Scanner(System.in);
  10.  
  11. System.out.println("Enter the first number");
  12. double firstNum = input.nextDouble();
  13.  
  14. System.out.println("Enter the Second number");
  15. double secondNum = input.nextDouble();
  16.  
  17. System.out.println("Enter 1 for addition, 2 for sub, 3 for mult 4 for div");
  18. int choice = input.nextInt();
  19.  
  20.  
  21. double total = file2.selector(choice, firstNum, secondNum);
  22. System.out.println("The value of that operation is: " + total);
  23.  
  24.  
  25. }
  26. }
  27.  
  28. //////////////
  29. //////////////
  30. //////////////
  31. //////////////
  32. //////////////
  33. //////////////
  34. //////////////
  35. /// file2.java
  36. //////////////
  37. //////////////
  38. //////////////
  39. //////////////
  40. //////////////
  41. //////////////
  42. //////////////
  43.  
  44.  
  45. package com.intJava;
  46.  
  47. public class file2 {
  48.  
  49.  
  50. private static double addNumbers(double a, double b){
  51. return a + b;
  52. }
  53. private static double subNumbers(double a, double b){
  54. return a - b;
  55. }
  56. private static double multNumbers(double a, double b){
  57. return a * b;
  58. }
  59. private static double divNumbers(double a, double b){
  60. return a / b;
  61. }
  62.  
  63.  
  64. public static double selector(int choice, double a, double b){
  65. double myNum=0.0;
  66.  
  67. switch(choice){
  68. case 1:{
  69. myNum= addNumbers(a, b);
  70. break;
  71. }
  72.  
  73. case 2:{
  74. myNum= subNumbers(a, b);
  75. break;
  76. }
  77. case 3:{
  78. myNum= multNumbers(a, b);
  79. break;
  80. }
  81. case 4:{
  82. myNum= divNumbers(a, b);
  83. break;
  84. }
  85. default: {
  86. myNum = -999.999;
  87. break;
  88. }
  89. }
  90.  
  91.  
  92. return myNum;
  93. }
  94.  
  95.  
  96. }
  97.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:45: class, interface, or enum expected
package com.intJava;
^
1 error
stdout
Standard output is empty