It works fine if it has set double values, but when you can pick it I can't get past
System.out.println("Enter the operation"); it closes after than and returns 0 (which is what it does if no other option is chosen) please help
I'm not a Java expert, so I can't tell you exactly why this is the case, but change
It might be because the last
sc.nextDouble() doesn't catch the final newline in that input (you type the number and then a newline, but
sc.nextDouble() might not catch that), so it "bleeds over" into the next input and thus causes the result of
sc.nextLine() to be empty?