Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4. import java.nio.file.FileSystemLoopException;
  5. import java.util.HashMap;
  6. import java.util.Map;
  7. import java.util.TreeMap;
  8.  
  9. import static java.lang.System.in;
  10.  
  11. public class Employee {
  12.  
  13. String name;
  14. double salary;
  15. String position;
  16. String department;
  17. String email = "n/a";
  18. String age = "-1";
  19.  
  20. public Employee(String name, double salary, String position, String department){
  21. this.name = name;
  22. this.salary = salary;
  23. this.position = position;
  24. this.department = department;
  25. }
  26.  
  27. public Employee(String name, double salary, String position, String department, String email, String age) {
  28. this.name = name;
  29. this.salary = salary;
  30. this.position = position;
  31. this.department = department;
  32. this.email = email;
  33. this.age = age;
  34. }
  35.  
  36. public Employee(String name, double salary, String position, String department, String age){
  37. this.name = name;
  38. this.salary = salary;
  39. this.position = position;
  40. this.department = department;
  41. this.age = age;
  42. }
  43.  
  44. public static void main(String[] args) throws IOException {
  45. BufferedReader reader = new BufferedReader(new InputStreamReader(in));
  46.  
  47. Map<String, Employee> map = new HashMap<>();
  48. Map<String, TreeMap<Double, Integer>> devMap = new HashMap<>();
  49. TreeMap<Double, Integer> innerMap = new TreeMap<>();
  50.  
  51. int n = Integer.parseInt(reader.readLine());
  52.  
  53. for (int i = 0; i <n ; i++) {
  54. String[] line = reader.readLine().split(" ");
  55.  
  56. String name = line[0];
  57. double salary = Double.parseDouble(line[1]);
  58. String position = line[2];
  59. String development = line[3];
  60.  
  61. if(line.length == 4){
  62. Employee employee = new Employee(name, salary, position, development);
  63. map.put(name, employee);
  64. } else if (line.length == 6){
  65. String email = line[4];
  66. String age = line[5];
  67. Employee employee = new Employee(name, salary, position, development, email, age);
  68. map.put(name, employee);
  69. } else if (line.length == 5){
  70. try {
  71. int number = Integer.parseInt(line[4]);
  72. String age = line[4];
  73. Employee employee = new Employee(name, salary, position, development, age);
  74. map.put(name, employee);
  75. } catch (Exception ex ){
  76. String email = line[4];
  77. Employee employee = new Employee(name, salary, position, development, email);
  78. map.put(name, employee);
  79. }
  80.  
  81. }
  82. }
  83.  
  84.  
  85. // if (!devMap.containsKey(development)){
  86. // devMap.put(development, innerMap);
  87. // }
  88. // if (!innerMap.containsKey(salary)){
  89. // innerMap.put(salary, 0);
  90. // }
  91. // devMap.put(development, innerMap);
  92. System.out.println( );
  93. }
  94.  
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement