import java.util.Scanner; class helloworld { public static void main(String args[]){ double fnum,snum,answer,dv; Scanner x = new Scanner(System.in); System.out.println("Enter your 1st number you wish to calculate: "); fnum = x.nextDouble(); System.out.println("Enter your 2nd number you wish to calculate: "); snum = x.nextDouble(); System.out.println("If you wish to multiply your 2 number click 1"); System.out.println("If you wish to Add your 2 number click 2"); System.out.println("If you wish to divide your 2 number click 3"); System.out.println("If you wish to subtract your 2 number click 4"); System.out.println("If you wish to find the remainder of your 2 number click 5"); dv = x.nextDouble(); if (dv == 1){ answer = fnum * snum; }else { System.out.println("You Entered a invalid Number!"); } if (dv == 2){ answer = fnum + snum; }else{ System.out.println("You Entered a invalid Number!!!"); } if (dv == 3){ answer = fnum / snum; }else { System.out.println("You Entered a invalid Number!"); } if (dv == 4){ answer = fnum - snum; }else { System.out.println("You Entered a invalid Number!"); } if (dv == 5){ answer = fnum % snum; }else { System.out.println("You Entered a invalid Number!"); } System.out.println(answer); } }

i need help, i am trying to program a console basic calculator in java, i want the user to be able to input a number the another, and then for the computer to out put the answer, BUT i also want them to choose what they want to be done with said number, so they choose 1 for times, 2 for add, 3 for /, 4 for -, and 5 for %. once they chose there number the system would out put teh answer, but IDK why it aint working! can some one help me, and tell me what is wrong with my code?