// TODO Auto-generated method stub //local declarations int months; double interest; double monthlyInterest; double loanAmount;
//create a scanner object
Scanner sc = new Scanner(System.in); //prompt the user to enter the Loan Amount System.out.println("Loan amount "); loanAmount = sc.nextDouble();
//Check the loan amount
while (loanAmount<0){ System.out.println("Enter postive loan amount"); loanAmount = sc.nextDouble(); }
//prompt the user to enter the number of months
System.out.println("Number of Months"); months= sc.nextInt();
//Check number of months
while (months<=0){ System.out.println("Enter postive amounts of months"); months = sc.nextInt(); } //prompt the user to enter the Annual interest rate System.out.println("Annual Interest rate"); interest = sc.nextDouble();
//Check Annual Interest Rate
while (interest <=0) { System.out.println("Enter a postive interest rate"); interest = sc.nextDouble(); }