Skip to content
Advertisement

Continuity Issue in Java Calculator

I am new to Java, and I’m doing a calculator APP.

I’m trying to get my calculator to keep prompting the user for the correct answer (typing Y or N) after the else statement following ‘Invalid Input’.
I want the program to continue with the calculations after the correct input is finally entered.

I have played around with an embedded while loop, but ended up with an infinite loop or a loop that terminates with no resolution. The code is below.

JavaScript

Advertisement

Answer

After adding the edits suggested by J.F. and Javaman along with some research, I was able to solve the problem by adding the following lines to my code:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement