This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 96ffc1b6 authored by OEResource sharing's avatar OEResource sharing
Browse files

OEResource: Update resource with id: 1ae9846a-15b6-4cc7-bd9a-1e516980aca9

parent 2dc6ea0b
Branches
No related merge requests found
public class CalculateGradesStatisticsSolution {
private static void calculateGradesStatistics(int[] grades) {
int countA = 0, countB = 0, countC = 0, countD = 0, countF = 0;
for (int grade : grades) {
switch (grade / 10) {
case 10, 9:
countA++;
break;
case 8:
countB++;
break;
case 7:
countC++;
break;
case 6:
countD++;
break;
default:
countF++;
break;
}
}
System.out.println("A: " + countA + "\n"
+ "B: " + countB + "\n"
+ "C: " + countC + "\n"
+ "D: " + countD + "\n"
+ "F: " + countF);
}
}
......@@ -14,6 +14,7 @@ description: "Es wird ein Array von Ganzzahlen entgegengenommen, das die Noten e
difficulty: easy
format:
- md
- java
keyword:
- Switch conditionals
language:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment