ans = JOptionPane.showInputDialog(null, "Enter amount to be withdrawn from checking");
double withCheck = Double.parseDouble (ans);
if (withCheck >= checking)
{
JOptionPane.showMessageDialog(null, "You do not have enough in your account for that.");
}
else
{
double sum = checking - withCheck;
JOptionPane.showMessageDialog(null, "Your checking balance is now: $" + sum + ", and your savings balance is: $" + savings);
}
}
目前此代码在 withCheck >= 检查时结束程序,我想知道一种使用某种循环再次询问问题的方法,直到“if”语句为假并且可以继续到 else 语句。