Still learning, looking for general advice about a 4-function calculator I programmed using java here's some code I wrote in java SE to get use to if statements and scanning. just looking for suggestions that will improve this program or/and teach me techniques that I should get use to using.
import java.util.Scanner;

public class Calculator {
   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 z = scan.nextInt();
      if (z == 1) {
         int a = x * y;
         System.out.println(&quot;Result: &quot; + a);
      }//end of if multiply
      else if (z == 2) {
         int a = x / y;
         System.out.println(&quot;Result: &quot; + a);
      }//end of if divide
      else if (z == 3) {
         int a = x + y;
         System.out.println(&quot;Result: &quot; + a);
      }// end of if add
      else {
         int a = x-y;
         System.out.println(&quot;Result: &quot; + a);
      } //end of is subtract
   }// End of main
}// End of public class

here's my new program, still not perfect but the class i'm taken hasn't even gone over data types and classes yet so i'm already ahead lol
Thank you every one for your help!
import java.util.Scanner;

 public class Calculatortwo {
   public static void main(String[] args) {
   //get imput values from user
      System.out.print(&quot;Enter the first value &quot;);
      Scanner scan = new Scanner(System.in);
      double x = scan.nextDouble();
      System.out.print(&quot;Enter the next value &quot;);
      double y = scan.nextDouble();
      System.out.println(&quot;Choose an operation: 1-multiply 2-divide 3-add 4-subtract&quot;);
      int operation = scan.nextInt();
    //calculator logic
      double result = 0;
      switch (operation) {
       case 1:
         result = x * y;
         break;
       case 2:
         if(y != 0) {
         result = x / y;
        }
        else {
        System.out.println(&quot;Error: Divide by 0&quot;);
        }
         break;
       case 3:
         result = x + y;
         break;
       case 4:
         result = x - y;
         break;
         default:
            System.out.println(&quot;Error: operation not found&quot;);
      }
            System.out.println(&quot;Result: &quot; + result);
   }
}
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);
   }