void searchForPopulationChange()
{
String goAgain;
String response;
int input;
int searchCount = 0;
boolean found = false;
boolean search = false;
while(search == false)
{
System.out.println ("Enter the Number for Population Change to be found: ");
input = scan.nextInt();
for (searchCount = 0; searchCount < populationChange.length; searchCount++)
{
if (populationChange[searchCount] == input)
{
System.out.print(""+countyNames[searchCount]+" County / City with a population of "+populationChange[searchCount]+" individuals\n");
found = true;
}
}
if (found == false) {
System.out.println("No records found!");
}
System.out.println("\n\n-------------------------------------------------------------------------");
System.out.println("\n\tDo you want to enter data for another Course? Type Yes or No: ");
response = scan.nextLine(); //the response is already recognized - thus ends or restarts the program
if (response.equalsIgnoreCase("yes"));
{
search = false;
}
if (response.equalsIgnoreCase("no"));
{
search = true;
}
}
}
} こんにちは!これはこれまでの私のプログラムです。基本的に、while ループが終了すると、ユーザーがプログラムを再度実行するかどうかを確認する必要があります。はい、もしくは、いいえ?印刷のプロンプトが表示されますが、スキャン機能が動作しません。何かアドバイス?