Slide 9
Slide 9 text
record StudentScore(String name,
String className, int score) {}
List scores = ...;
ྫ"ͷੜెͷฏۉࢉग़
record StudentScore(String name,
String className, int score) {}
List scores = ...;
double sum = 0.0; int count = 0;
for (int i = 0; i < scores.size(); i++) {
var ss = scores.get(i);
if (ss.className().equals("A")) {
sum += ss.score(); count++;
}
}
sum /= count;
தؒঢ়ଶอ࣋ͷͨΊϛϡʔλϒϧ
είʔϓ͕͍
ϧʔϓ੍ޚ
औग़ɺ
݅
Ճࢉॲཧ͕ҰମԽ
ҙຯͷҟͳΔͷೖ