Advertisement
SIRAKOV4444

Untitled

Jun 1st, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1.  
  2. import java.util.*;
  3.  
  4. public class Lab {
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7.  
  8. int times = Integer.parseInt(scanner.nextLine());
  9.  
  10. Map<String, Double[]> grades = new TreeMap<>();
  11.  
  12. while (times-- > 0) {
  13.  
  14. String student = scanner.nextLine();
  15. String[] SeparatedScores = scanner.nextLine().split("\\s+");
  16. Double[] scores = new Double[SeparatedScores.length];
  17.  
  18. for (int i = 0; i < SeparatedScores.length; i++) {
  19. scores[i] = Double.parseDouble(SeparatedScores[i]);
  20. }
  21. grades.put(student, scores);
  22.  
  23. }
  24. for (Map.Entry<String,Double[]>enter:grades.entrySet()) {
  25. System.out.println(enter.getKey()+" is graduated with "+enter.getValue());
  26. }
  27.  
  28. }
  29. }
  30. //Gosho is graduated with 4.375
  31.  
  32. //3
  33. //Gosho
  34. //3.75 5
  35. //Mara
  36. //4.25 6
  37. //Pesho
  38. //6 4.5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement