The only way to print values is by having them. In other words, you have to store the values when you receive them.
You have probably already heard of arrays. While there are more dynamic solutions, a static array suites your problem. You know that you need to store (at most) 20 scores. Therefore, make an array for 20 scores.
Btw, why is clas a double? Would it not be rather morbid to have 3.14 students?