我的編碼看起來像如下:teacher.input(score [i],i);意思?
public class teacher2 {
Score[] Score;
public teacher2() {
Score = new Score[10];
for (int i = 0; i < Score.length; i++)
Score[i] = new Score();
}
public void input(float[] score, int id) {
Score[id].setScore(score);
}
public void check() {
int count;
for (int i = 0; i < 5; i++) {
count = 0;
for(int j = 0; j < Score.length; j++) {
if (Score[j].getScore(i) >=60)
count++;
}
System.out.println("pass rate of class " + i + " is: " + (count /10.0) * 100 + "%");
}
}
public static void main(String[] args) {
teacher2 teacher = new teacher2();
float[][] score = {
{ 45, 56, 88, 96, 78 },
{ 77, 85, 65, 89, 75 },
{ 86, 96, 75, 98, 90 },
{ 52, 78, 95, 45, 25 },
{ 45, 12, 69, 88, 56 },
{ 45, 56, 88, 96, 78 },
{ 77, 85, 65, 89, 75 },
{ 86, 96, 75, 98, 90 },
{ 52, 78, 95, 45, 25 },
{ 45, 12, 69, 88, 56 },
};
for (int i = 0; i <10; i++){
teacher.input(score[i], i);
}
teacher.check();
}
}
- 我想知道什麼呢
teacher.input(score[i], i);
意思,因爲當我用「輸入」關鍵詞在網上搜索,所有這些出山約input.netline(); - 對於最後一行,當我們想要檢查的時候,沒有必要輸入編碼,只需輸入variable.check()?
任何幫助將不勝感激!
*「任何幫助將不勝感激!」 - - 因爲你問。您需要修復代碼的縮進,並遵守標識符的Java樣式規則。一個Java類名稱應該總是以大寫後面開頭。 – 2014-09-11 11:17:21