Still learning, looking for general advice about a 4-function calculator I programmed using java
It would be best to codify the various operations in a separate function. This limits the opportunity for error and eliminates the redundancy of the System.out.println(&quot;Result: &quot; + a); statements.
   private static int applyOperation(int x, int y, int op) {
      switch(op) {
         case 1: return x*y;
         case 2: return x/y;
         case 3: return x+y;
         case 4: default: return x-y;
      }
   }
   public static void main(String[] args) {
      System.out.print(&quot;Enter the first value &quot;);
      Scanner scan = new Scanner(System.in);
      int x = scan.nextInt();
      System.out.print(&quot;Enter the next value &quot;);
      int y = scan.nextInt();
      System.out.println(&quot;Choose an operation: 1-multiply 2-divide 3-add 4-subtract&quot;);
      int op = scan.nextInt();
      int ans = applyOperation((x), y, op);
      System.out.println(&quot;Result: &quot; + ans);
   }