Guest User

Untitled

a guest
Feb 24th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. package com.javarush.task.task10.task1018;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6. import java.util.HashMap;
  7. import java.util.Map;
  8.  
  9. /*
  10. Поправочки нужны
  11. */
  12.  
  13. public class Solution {
  14. HashMap<Integer, String> map;
  15. static Integer index;
  16. static String name;
  17.  
  18. public Solution() {
  19. this.map = new HashMap<Integer, String>();
  20. //map.put(index, name);
  21. }
  22.  
  23. public static void main(String[] args) throws IOException {
  24. Solution solution = new Solution();
  25. BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  26.  
  27. for (int i = 0; i < 10; i++) {
  28. int index = Integer.parseInt(reader.readLine());
  29. String name = reader.readLine();
  30. solution.map.put(index, name);
  31. }
  32.  
  33. for (Map.Entry<Integer, String> pair : solution.map.entrySet()) {
  34. index = pair.getKey();
  35. name = pair.getValue();
  36. System.out.println("Id=" + index + " Name=" + name);
  37. }
  38. }
  39. }
Add Comment
Please, Sign In to add comment