I am writing a Kalculator class code that requires.. blah here
Code:
System.out.println ("Select an operation (1,2,3,4) \n"+
" 1.Add \n"+
" 2.Subtract \n"+
" 3.Multiply \n"+
" 4.Divide \n"+
" 5.Exit \n");
System.out.print ("You have choose choice: ");
and i want choice 5 to be the exit, so when they type exit, the screen closes
i am doing this program by if else statements, i am new to java and would sincerly appreciate for a straightfoward answer.. ex) just type abc123 for the command to close the screen... i hate it when these "experts" go off topic and never answer me, yet still call themselves experts...
this code below works.. dont tell me how to improve it.. please tell me what goes after else if (menuChoice==5), thank you in advance, i would like to bring this into class tomorrow, so please tell me what the code to close the screen would be.
Code:
if (menuChoice==1)
result = num1 + num2;
else if (menuChoice==2)
result = num1 - num2;
else if (menuChoice==3)
result = num1 * num2;
else if (menuChoice==4)
result = num1 / num2;
else if (menuChoice==5)
HowDoICloseScreenHere?