The program runs good but the nested do-while loop is not working. If you see the condition of the while 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. You can see that the principal do- while has to validate that principal is not equal to 0 if it is it goes out from the program
I declare:
import java.util.Scanner;
import java.text.DecimalFormat;
public class ACMEMORTGAGE
{
public static void main (String args [])
{
//Declare variables
int mortgageTerm, principal;
Scanner key=new Scanner(System.in);
DecimalFormat decimalPlaces=new DecimalFormat("$0.00");
do
{
System.out.print("Enter principal amount (0 to end program):");
principal=key.nextInt();
do
{
System.out.print("Enter mortgage amortization (1, 2, 3, 5, 10.):");
mortgageTerm=key.nextInt();
} while (mortgageTerm==1 || mortgageTerm==2 || mortgageTerm==3 || mortgageTerm==5 || mortgageTerm==10);
}while (principal!=0);
}
}