Grades

Report a typo

Find the number of D, C, B and A grades for the last test on informatics, where n students from a class have successfully passed the test.

The program gets number n as the first line of input. This means there will be n number of grades. Then the program gets the grades themselves, each on a new line.

Create a program to count the the occurrence of each grade and output four numbers in a single line: the number of D, C, B, and A grades (in that order), separated by blank space characters.

Sample Input 1:

13
B
C
D
C
B
C
D
D
B
C
C
B
A

Sample Output 1:

3 5 4 1
Write a program in Java 17
import java.util.Scanner;

class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// start coding here

}
}
___

Create a free account to access the full topic