I'm trying to do a nested if inside a loop. The user has to enter a period between 5, 10, 15, 20, 25 years. Each year has a different rate and if the user enter a number that is not within these numbers the question is ask again.
The program runs good but the nested do-while loop is not working. If you see the condition of the while then you can see that it have to be a validation and if it is not in the range of those numbers it has to ask the questions again. And if you type 0 it ends the progam. The validation it's not working and I don't not why
public class ACMEMORTGAGE
public static void main (String args )
double principal, rate=0;
Scanner key=new Scanner(System.in);
DecimalFormat decimalPlaces=new DecimalFormat("$0.00");
System.out.print("Enter principal amount (0 to end program):");