I am extremely new to java I am in my second week in classes or so--
I need my program to keep going or exit according to the user. It is a payroll calculation and I wan
Here is a brief idea of how to do this:
String choice = "y";
while(true) {
//Take input
System.out.print("Do you want to continue (y/n)?");
choice = reader.nextLine();
if(choice.equalsIgnoreCase("n")) break;
//else do your work.
}
You can also sue do-while
to get what you want. You may need to make some changes but then that is the entire idea. It is just a hint.