I'm trying to make a method that will ask the user the amount, then it checks if the amount if >0 and if it is the loop ends and if the input isnt >0 then the loop continues until proper data is entered. I can't figure out my problem..
/** Get principal amount **/
public static double getPrincipalAmount(double numb1) {
Scanner input = new Scanner(System.in);
do {
System.out.print("Enter Loan Amount: ");
double numb1 = input.nextDouble();
double getPrincipalAmount = 0;
if (numb1 > 0) {
getPrincipalAmount = numb1;
} else {
System.out.println("Data Error: Loan amount must be greater than zero. You entered " + numb1);
}
} while (numb1 < 0);
return getPrincipalAmount;
}