私は、infileから各整数を読み取り、それをメソッドadScoreに渡そうとしています。このメソッドは、文字の成績、すべての成績の合計数、および最高の試験スコアと最低の試験スコアを決定します。しかし、forループを実行するときのwhileループは、system.out.printを実行するforループの後にデバッグしているため、infileからデータを取得していません。そして、返されるのは、ループ内の私のカウンターである0〜29の数字だけです。インファイルから成績スコアを取得できるように、私が間違っていることについて私を支援できますか?
よろしく。
while(infile.hasNextInt())
{
for(int i=0; i <30; i++)//<-- it keeps looping and not pulling the integers from the file.
{
System.out.println(""+i);//<--- I placed this here to test what it is pulling in and it is just counting
//the numbers 0-29 and printing them out. How do I get each data from the infile to store
exam.adScore(i);//determines the count of A, B, C, D, F grades, total count, min and max
}
}